I have created a custom WordPress plugin that will display a list of information and i will have the ability to add or edit this information. This seems easy but somehow i am not able to make it work how i would like it to. I have a list of companys and i am showing this list in a table. For each company, i can change its info.
I want to make it so when i click on settings or profile that the page will change and i will pass in the id of the company as a parameter.
I can add a new php page to the href but then that navigates to a new page and i am no longer in the admin dashboard. How can i navigate the url to another page with id without having to leave the dashboard?
When i created a plugin i created submenu pages and when i navigate to these pages... i am executing code all in the same file but different functions with different html which i feel is the way i want when navigating to Settings or Profile for a company.
You can do this by following the below steps:
If you admin/dashboard page URL is something like this: /wp-admin/admin.php?page=list then you need to add extra parameter for settings & profile page like this way: /wp-admin/admin.php?page=list&action=settings&id={id} or /wp-admin/admin.php?page=list&action=profile&id={id}
After that, you need to check if $_GET['action'] is profile or settings, then you need to render the profile page or settings page content respectively instead of list page content. Otherwise, if the action parameter is not set you can render the list page content.
Let me know if you need further assistance.
Related
I have a multi-site setup and i want to add a global user profile page to all sites. Based on advice i was given i used a page template. I have created a file called myprofile.php and in here it does all the magic to create a page. The problem i have with this is that i must create a page within the WordPress admin panel that uses this template.
With multiple sites on the network I don't want the risk of someone deleting the page from the list or forgetting to add it etc and it causes a bunch of 404 errors, denying users basic functionality.
I want to be able to add a page to my entire WordPress install, including all multi-sites. It needs to be able to do everything that my page template does, but doesn't require a Page to exist in the page listing.
I tried doing this using a php file and using mod_rewrite, calling the WordPress header and footer and this worked, but its returning a 404 error even though the page content is displaying. I was able to manually set the header to 200 using php, but this isn't being picked up by all header scans that i have performed and its not a solution i am particularly happy with. I would like to build this into WordPress rather than making it separate and calling WordPress externally.
Can this be done?
Edit.
In needing a profile page i will also need a login, view other user profile page, change account settings and any other error/account related pages that come with a user profile, so having to create a dozen custom pages for every multi-site is going to be very annoying and messy.
I am also not using the WordPress user database for this as I use the user accounts for various other things outside of WordPress.
In every module and section of opencart we see a drop down called layout. Which usually contains pages such as category, news, product, default, home, etc...
How can I add a page to this section?
Now, I can add a CONTENT_PAGE via information->insert.
Else, I usually do it by creating a controller and a template, but the page I create is not formally recognized by opencard.
My question is that I should I make open card recognize my page which I create by making a controller and a template manually within the project folder. How?
thanks in advance
Though these questions suit more for OpenCart forum instead of SO, I'll try to answer the first one shortly:
How can I add a page to this section?
Go to administration -> System -> Desgin -> Layouts and click on Insert button. Here You can define a new layout (e.g. You have a custom page with controller that is accessed via URL index.php?route=information/mycustominformation, add it's route information/mycustominformation as a new layout route).
The second problem is completely unclear to me. Can You be more specific and describe in more details?
I am using Carrington Build theme and I've created a custom module.
Now, I need to check in which pages these modules are being using and generate a list somewhere else.
To achieve this I am trying to get the current page in which the module has been added from the admin side page. but everytime I open the module admin panel in the page it never returns the existing page with the following wp commands.
I was wondering if anyone could tell me how to get the current page from the admin side?
I've tried get_the_ID(), wp_title(), single_post_title()
I'm a newbie to wordpress, I added a new page via dashboard, and I want to make a link to this page from the home page so I would love to know what function does that,
I think it would be something like:
>LINK
Thanks in advance!!
You could use
Link Title
Where PAGE_NAME is the page title you have set in the dashboard.
get_page_by_title() returns an object and we use get_page_by_title( PAGE_NAME )->ID to return the page ID of that page. Note that it is more consistent to rely on the page title (which you set yourself) against page ID (which is set by wordpress).
get_page_link() retrieves the permalink of that page ID you passed as parameter.
You can simply link to the page in the HTML body of the home page. For example:
your page
or
your page
Where ###, put the post ID.
More examples
Edit:
If you are editing a template, and wish to obtain the permalink of the post using its ID, use get_permalink($id)
More information about this function
Edit 2:
Based on your comments, you have to switch the permalink format. In WP Admin, find Permalink Settings, and set them to /%postname%/
Read more about these settings here
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!