I got my own created template in Wordpress. I got two pages : index.php and ab.php. My question is what should be a proper link code that links these two pages in menu? Because I always get 404 page or index.php page or blank. I try'ed everything including saving permalinks.
Here are a few of my examples:
http://example.com/?p=ab
http://example.com/?p=ab.php
<a href ="ab.php">
etc.
My guess is that this is your first WP theme.
If that is the case I should tell that the hierarchy from pure php websites won't work. Check this https://developer.wordpress.org/themes/basics/template-hierarchy/ WP uses the wp-admin part for creating new pages.
If you are switching from php to WP, I think I can help a bit by giving few pointers.
If there is an issue with your project I can't quite get what is happening but if you call http://example.com/ab.php the php inside will run however it's not cool to reference pages that way in WP.
Related
I installed Wordpress in "localhost/" directory.
I created a file called home.php and designed it as a landing page.
I want to move my default blog posts to the "localhost/blog/" directory.
But I don't want other links to be affected by this. So "localhost/blog/contact" is wrong behavior.
But every way I tried caused problems like this.
https://wordpress.stackexchange.com/a/238727/183195
https://wordpress.stackexchange.com/a/245136/183195
https://wordpress.stackexchange.com/a/131667/183195
https://stackoverflow.com/a/60605443/12944128
All of these only work as a "single post" way. So "localhost/blog/" does not contain an archive and will not work. Only the "localhost/blog/post-slug/" link works.
Is it that difficult to create a blog with an archive page of its own "slug" in WordPress?
Don't believe you can do it without some serious htaccess manipulations. The permalink structure is set up for either including the 2nd level or not, no in between.
I am working on adding AMP to my wordpress single.php page. I have installed the plugin and am making the edits I need to have it looking correct. The issue I am having is many of my posts are multiple pages and I am trying to figure out how to get wordpress to render the other pages using AMP.
For example if i have a page with the url:
www.example.com/post-category/post-title/amp/
That would render perfectly using AMP BUT if I try to do:
www.example.com/post-category/post-title/2/amp/
That redirects to a different post instead of going to the second page of the intended post. If anyone has any idea of how to make this work as it should I would be very grateful. This is the last part I have to figure out to get my pages to work with AMP.
Thanks!
I created a webpage in Standard HTML and CSS and everything looks / works exactly how I want it too.
Now I need it to appear as it is on a wordpress site (http://www.texasenergyessentials.com/). I already created a template page and can see it in the template select in the wordpress "add new page" window. I was hoping I could just select the template and leave the text editor blank but that doesn't seem to be the case. All I get is a completely un-formatted page that says welcome guest.
What is the easiest way to get https://gist.github.com/anonymous/8545681 to work on the aforementioned wordpress site? ?
Thanks!
P.S. Please don't link any codex files I just spent 2 hours digging around in them :(
Try to read and understand how http://codex.wordpress.org/The_Loop works
Install this theme https://code.google.com/p/wordpress-naked/ and try to work your way to the desired theme by editing theme files. That will be much easier.
Maybe the problem can be understood by reading the template hierarchy:
http://codex.wordpress.org/Template_Hierarchy
(especially check the visual overview)
If you name your file page-[insert-page-id-here].php Wordpress will use it for the page you've created. Get your page id by editing the page and looking it up in the url.
As the title says, I'm currently working on a theme and i've found a bit of a problem.
Let's say I make a page called test and give it the custom page template of test-page-template
so far that works fine if I go view the page but the problem comes when I set the homepage to use my page as the static homepage; what happens is instead of using the test-page-template it uses front-page.php.
The obvious work around would be to edit front-page.php to be the same as test-page-template but that's a bad solution if a client wanted to select a different page as the static front page. Any ideas?
This is happening because of the WordPress template hierarchy. Front-page.php takes priority as compared to page template, when it comes to the front page of the blog. Here is the heirarchy graph:-
I'm not sure of the complete requirements, but I would suggest you to use index.php and page templates in that scenario.
I am trying to add the custom field "market" into the a href as links, which is working great on pages, however is not working on my home page.
The PHP is identical for both.
For the home page, the php is in the functions.php file, and for the theme-by-series page the PHP is in the page's .php file.
The page works, so it doesn't seem to be anything wrong with the PHP, seems more like it for some reason is not targeting the post id as it should.
Anyone know how to solve this?
Custom fields are saved per post/page, and this is likely why it's not loading on your index.php page. You need to replace $post->ID with the ID of the post/page you want to show your custom field for - the $post object is available on the page.php and single.php templates, which is why it works there. On the index page, it would only be available inside the loop.
Look up the WP Docs on how to Reset the main WP Loop Query:
http://codex.wordpress.org/Function_Reference/wp_reset_query
If you're getting different results in functions.php vs a page template, there's a good chance its because your page template has already started a query loop and its conflicting somehow. This is just off the cuff without looking at the code. I'm going by your description of the difference betweeen working and non-working models.