I am building custom theme. If I have got long post (like review, tutorial) I would like to cut this post for 5 parts. I would love to make navigation at the bottom of post. So, I have added this code to post, but it does not show navigation:
<!--nextpage-->
So, I have added this in the place of single.php, but it also does not show this:
<?php wp_link_pages(); ?>
How to add this element?
OK, I got it. It is very simple...
<?php wp_link_pages(); ?>
Shoud be in the loop...
Related
Hi i have an wp website and i'm using avada theme. I want to hide header according to its category. For example if posts category is "A" then i dont want to show header on the top automatically. I know i can manually adjust that in the post settings on every posts, or set a layout and select that layout on the below but i dont want to deal that every time.
So i try a if statement in the archives.php.
its something like this:
<?php if(has_category( 'A' )) : ?> //i also try in_category and on_category
<?php else: ?>
<?php get_header(); ?>
<?php endif; ?>
but its probably for category page itself but not for posts.
Can anybody help with that?
Thanks :)
hi you can go with following links and follow the given solution it may worked..
here it show that how to hide specific c***ategorize header post*** ...
https://wpquestions.com/Remove_header_or_styling_from_specific_category_of_posts/11505
I'm making a WordPress theme by myself since I'm working for the first time in Wordpress I've watched some tutorials about it.
I have page.php header and footer and ofc an index. I insert the content from the pages with this:
<?php echo get_post_field('post_content', $post->ID); ?>
but I tried the get_post in a while loop with same result..
Everything is fine but when I want to use a plugin I can't add to my page... When I insert the shortcode of it it shows only the shortcode string... There are some plugins where I can click a "view" option and it would show a page with my plugin (for example a calendar) but that page is empty...
When I activate an original theme it works instantly... So I'm sure something is missing from my theme something which can load the plugins but I couldn't find solution for it.
Any ideas?
Did you add the <?php wp_head(); ?> function before the head area of the html document is closing? It imports important scripts and styles from wordpress itself (and probably also from the plugins).
See here:
https://developer.wordpress.org/reference/functions/wp_head/
Before closing the body area, the template should also include
<?php wp_footer();?>
See here:
https://developer.wordpress.org/reference/functions/wp_footer/
I've created a static page and by using the "Posts in page" plugins, have added a single post to the page.
but it seems that the post is cut off and adds a [...] at the end of the post.
I've checked the page.php file and it says <?php the_content(); ?>
where the content should appear.
How can I show the complete post, without getting it trimmed?
In
posts-in-page/posts_loop_template.php
Change
"the_content" to "the_excerpt"
LOL, I got them seer skillz.
i am trying to insert a post/page into one of my themes files and it wont display shortcodes or php
i have created a page called home in the wordpress admin-paned and inserted into my code the following:
<div id="home_page"> <!-- echos the content from the page "home" id:43 -->
<?php $home_id = 43;
$home_page = get_page( $home_id );
?>
<?php echo $home_page->post_content; ?>
</div> <!-- end #home_page -->
and non of the shortcodes that i have in the page work.
i installed a php in post or page and tried useing php and it doesnt work.
when i insert
echo do_shortcode('[youtube_sc url=http://www.youtube.com/watch?v=Db3XGpt6nNU]');
directly into the code it works.
does anyone know y this happens?
thank you.
I got an answer in wordpress.stackexchange.com
I Quote:
You need to apply the filter the_content e.g.:
<?php echo apply_filters('the_content',$home_page->post_content); ?>
Also, you don't need custom shortcodes for youtube, just put the URL in the content (but not a hyperlink), and it'll be swapped out for a youtube player at runtime. No plugins or extra code needed thanks to oembed.
Thank You Tom J Nowell
The $home_page->post_content value is the exact post content as stored in the database. Echoing this does not give any of your shortcodes a chance to run.
You should use a "WordPress Loop" to display the content, as this sets things up to allow you to use template tags such as the_title() and the_content() - this will call the processing functions for shortcodes and other functions like wpautop() that "massage" post content for output.
If you don't want to use a Loop, you could output the content using
echo do_shortcode($home_page->post_content);
This will run the post content through the shortcode processor, giving the shortcodes a chance to run.
For more on how WordPress "massages" post content, you can look here: http://codex.wordpress.org/How_WordPress_Processes_Post_Content
I am modifying a wordpress template and need to slightly separate rendering logic for a post and a page, specifically in relation to how the date renders out. The problem is that I cannot find any code to do this, I am sure that it exists. Is there a variable that exists within wordpress that tells me whether the item being displayed is a page or a post?
In an ideal world it would look something like this:
<?php if (is_page()) : ?>
page logic
<?php else: ?>
post logic
Would appreciate any help!
Pages are a type of post, so get_post_type should return appropriately different values for pages vs normal blog posts.
I found this link: http://wordpress.org/support/topic/sidebar-logic-for-postblogroll-and-page-type which seemed to do the business for me.
The answer (copied straight from the page) was:
<?php if(is_singular($post)): ?>
Page Content
<?php else:?>
Post Content
<?php endif;?>