nielss
Forum Replies Created
-
Nvm, I fixed it. I was adding the page before wp_loaded was called.
Nvm, I fixed it. I was adding the page before wp_loaded was called.
Thank you! I guess I’ll make a dummy page then. It worked. Do you perhaps know a solution to the following error?
Fatal error: Uncaught Error: Call to a member function get_page_permastruct() on null in C:\xampp\htdocs\TwizoAdminTFA\wp-includes\link-template.php
The code that is causing it:
if(!$this->page_exists_by_slug('twizo-verification')){ $newPage = array( 'post_title' => '2FA Settings', 'post_name' => 'twizo-verification', 'post_type' => 'page', 'post_status' => 'publish' ); wp_insert_post($newPage); } public function page_exists_by_slug($page_slug) { $page = get_page_by_path( $page_slug , OBJECT ); if ( isset($page) ) return true; else return false; }
I solved a part of the problem! I found out that there are different layouts for some themes and I appear to use twentyseventeen, which is different from the rest. I solved that problem.
My only problem now is: I get a 404 error when I go to my page. It still works fine, but the page title is “page not found” and some of the css even has 404 classes.
Any ideas?
Anyone got an idea how to make sure I do get this right?
I feel like it has to do something with the chosen layout type? Are there more? I can’t find any documentation on these kind of things.
My only problem at the moment is:
When I make a page as shown above, it works perfectly apart from:
– The page doesn’t wrap the primary and secondary content with a div that has the ‘wrap’ class. This makes the styling weird while I guess it should be possible?
– The page has the title “page not found”Please help me!
I tried doing this, but the same things seems to be happening. I copied the exact orders.php page but I still get this difference in styling. I noticed a few things when I copy the orders.php page:
– The styling is off, which is likely because there is no div with the wrap class around the elements with primary and secondary.
– There is no page title. It is set to “page not found” but I still end up at my page.Do you know if anything could’ve gone wrong?
In short:
Atm the page looks like this: https://imgur.com/a/WdrZepo
While I want it to look like this: https://imgur.com/a/sgIhOhi
@azrielnefezen I have some questions that I came up with during the application of this solution:
– How to I correctly set the title of the page when I arrive on my settings page? I get “page not found” as the title.
– I found out that to mimic the styling of for example the My Orders page, I have to use the css class wrap to wrap the primary and aside elements. How would I do this? I was only able to wrap content in primary.Thanks in advance.
EDIT: I had more questions but I solved one.
@azrielnefezen you are truly amazing. Thank you very much for this. It works! Your answer has given me some insight on how this works and will definitely help me in the future as well. Thanks a lot!