Front-end form (via page template) to control WordPress Customizer - php

I'm working on a project where I want to prevent user access to the WordPress dashboard. As a result, there are some items the user needs to have access to in order to populate and configure the site.
How do I create a front-end form (via WP page template) for editing theme Customizer settings like the header image and color settings?
I already developed front-end forms (via page templates) for creating, editing and deleting posts. What I don't have is a way for the user to edit a handful of options available on the Customizer screen.
UPDATE
I found update_option() to control site title/description, but still not sure about header image and color settings.

Related

Finding and editing a WordPress site in cpanel w/o access to WordPress

I have a client who needs his website edited, he is no longer in contact with the original creator of the site, and it seems that the creator used WordPress to make the website. I've been able to access the page through cPanel but cannot locate the HTML files necessary to do things such as editing text. I have the ability to change images but the owner would like to remove some pages, etc.
There are also tons of PHP files for the WordPress extensions and such, but I know nothing about PHP.
Would I need access to the wp-admin account that designed the page in order to modify the text?
Wordpress stores page content in a database, which is subsequently loaded by a collection of php files. You cannot change the content or looks of a wordpress site by changing html files.
The easiest way to change content is to log in to the wordpress dashboard of the website. If you don't have the password, you can open up phpmyadmin via cpanel, browse to the wordpress database and find the *yourwebsiteinitials*_users table. In there you can choose one of the accounts that should be there and click edit, then edit the user_pass column, and simply type a new password in value and set function to md5. Then you can go to *yourwebaddress*/wp-login.php in your browser and login with the user you just edited and the new password.
Alternatively you can find posts in the _posts table and change content via phpmyadmin, but it's much easier to do this via the dashboard.
There could be a few things you need to be aware of: and I believe you have a good understanding of WordPress. If not you may want to watch some tutorials about it.
Themes: You need to find out if the previous developer develop with custom template and maybe he hard coded all the text inside themes file which located wp-content/themes/{name of the theme}/ {other file}, in this case, if you are not aware of WordPress theme development or how it structure, I suggest you watch some quick tutorial on it and there are tons.
Yes, wp-admin is the place where you can find all the pages listed or posts or whatever content. By editing page, you easily can change the text or delete the page which not require or add a new page.
Just find what is the way it's coded. then you will able to follow
You can log into the WordPress dashboard from the cPanel, following these steps:
Login to cPanel.
Scroll down to the Softaculous Apps Installer section and click on the WordPress icon:
You will be directed to the WordPress Install tab.
Scroll down to the Current Installations section.
Click on the admin icon to login to the WordPress dashboard without a password:
You will then reach the WordPress admin dashboard- voila!
if you want delete page in WORDPRESS you need to login wordpress and delete from pages and if you need delete custom php pages you need to go to cpanel and public html folder your page name or delete from wordpress go to /public_html/wp-content/themes/active theme name/ and find there page name there extenstion of pages is like pagename.php or pagename.html.

How to make WordPress pages where only certain (multiple) areas of content are editable

It has been a few years since I properly worked with WordPress. Now I have a proposal to build a WordPress site where every page has a custom design and only some areas of each page is editable.
The reason for this is to build a bespoke layout on each page which cannot be messed up by someone non-technical editing it in the CMS, except for small areas which they can customise.
e.g. A page contains one div which has some text in it, which can be edited in the WP admin backend, but the rest of the page cannot be edited.
Can this be done? How?
Edit: There needs to be multiple editable areas not just one. I know how to make custom pages/templates.
One method may be to create new page templates. Just create a new file in your main theme folder (or the templates folder if there is one). As long at the top of that file contains the line:
/*
Template Name: <your template name>
*/
You can design the page however you want. The data pulled from the admin section will go wherever you invoke
the_content();
The rest of the page can be hardcoded.
Then on the post edit page, on the right side (usually), you can choose the template with your template name for that page. It may be a good idea to copy the current post.php or single.php into your custom file and work from there.
For restricting access you can look at setting up user levels and keep your content contributors as "Authors" instead of "admins" so they can't change themes or edit settings.
(See https://codex.wordpress.org/User_Levels)
For creating specific unique pages with an area that gets changed you should look into custom Page Templates. You can create a page template by dropping a php file with the right naming structure into your theme hierarchy and it will get picked up by the back-end as template option when you create a page.
(See https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/)
I solved this problem using a plugin called Advanced Custom Fields which does exactly what I required.

Wordpress Plugin - Open Pages Inside Admin Panel

I am making a plugin. The plugin has pages that access a database, add, edit and delete records, call stored procedures etc. I have gotten as far as creating the plugin, and adding menus and submenus to the admin panel and having those menu links open in the admin panel. These are pages that handle the adding, deleting and editing of records in the database. Some of these pages have a link that would pass an id for example to another page in order to edit a record.
Those pages that are used in the admin panel of my plugin, that link to other admin pages for my plugin, do not open in the admin panel, they open outside of it. How can I create links in my plugin pages to stay inside of the admin panel of wordpress?
To clarify, I am able to add menu items that load pages in the admin panel. Maybe this screen shot will explain. So how can I open pages inside the admin panel?
In order to display your plugin's administrative UI within the framework of the WordPress dashboard you need to follow quite a few WordPress conventions.
The first is to write code for each administrative panel in a separate function. Each of these functions (one per admin panel in your plugin) must display the panel's HTML elements in a <div> object, allowing WordPress itself to wrap your divs in the dashboard display.
The next is to write a menu-building function for your plugin's dashboard menus, and then register that function with the admin_menu action hook. This menu-building function will contain references to your functions to display administrative panels.
Here is a writeup on the topic. http://codex.wordpress.org/Administration_Menus

Editing template content from the dashboard screen in Wordpress

I would like to set up a way to be able to edit content in my template form the wordpress dashboard or new admin page.
Something like creating input boxes on the dashboard, or on a new admin page, that would update specific content I have hard coded in my template.
I'm using a one page site (long scrolling), and would like to allow people to edit the separate content areas from an admin page.
(an existing plugin that does this would be fine too)
Thanks!

Apply theme based on user selection in Wordpress?

I have an idea to create a template sites that basically shows a different templates in web page. When user select particular template, The site should have changed to that theme selected by user at run time. Is there any plugin to change the theme dynamically in wordpress. If not kindly help how can we implement this ?
This plugin called theme preview basically does what you want. Instead of actually switching the theme, it will preview it for the user, so only the actual user is affected of the theme change and not the whole environment!

Categories