"more tag" doesn't work
-
<!–more–> tag doesn’t work in the lead of the posts.
Any advice?
Check it out:
https://foamfatale.com/foamfatale-blog/
-
It works, You have to display the full content in post lists in order to use the more tag instead of the excerpt.
Appearance -> Customize -> Pages & Posts Layout -> Select the length of posts in lists (home, search, archives, …) -> Display the full content.Sorry to say it doesn’t work for me. Although the more tags are pasted, the full content of posts are displayed ?? Have a look: https://foamfatale.com/foamfatale-blog/ I will leave it so for a while or till you confirm viewing. Thx
That’s weird.. to me it works.
I can see in your page source:<span id="more-1018"></span>
That is good if you’re viewing the article but is wrong if you’re viewing a list of posts.
You should have something like:<a href="https://foamfatale.com/foam-application-efficiency/#more-1018" class="more-link">(more…)</a>
It could be a plug-in problem. Probably some plug-in filters the content preventing that replacemnt ..?
Try to de-activate all your plug-ins.I.g. at the begining of the last post I wrote in the post editor (viewing text):
METHOD FOR COMPARISON OF DIFFERENT TANK FIRE EXTINGUISHING TECHNOLOGIES – PART 3.
<h4>How can we improve the success rate of the Storage Tank fire fighting??We have good news for the Fire Experts: we have the opportunity for positive influence on the measured efficiency by changing the parameters of the tank fire fighting.<!–more–></h4>
The optimum performance we can achieve in two steps:but still…
I checked all plugins, no plugin to effect the appearance of posts ??
Checked or de-activated?
To be sure, just use a default theme (twentyfourteen) for a moment. Look if that more tag works with it (I don’t think so, but I can be wrong). If it doesn’t isn’t a customizr issue. Could be you not putting that tag right (and I don’t think so, since it’s just about pushing the button “more” in Text mode) or.. a plug-in. Can you see other reasons?
To have a blog page in cuztomizr! is tricky. I had to make a special page template, my is called “blog posts” and drive the posts on this page. So appear the posts as you see on website.
Therefore I can not test it with twentyfourteen theme. I tried, but only the “blog posts” page can be seen. On the right side we can see the recent and archive posts as well, clicking on them we can call that post.I switch to twentyfourteen for you for a while if you want to check.
If you want your latest posts on home and also a blog section, yes you have to do a page template, or use a plug-in (but in that case you will lose customizr post list rendering, I think). But your home isn’t showing last recent posts. So why did you do that? Anyway if you want to do that, of course, it should be allowed to you, and now we have to figure out what’s wrong. ??
You can switch to twentyfourteen and set the same menu you use with customizr, then go to a archive/category page and see if you can see that more tag.
Or go there https://foamfatale.com/foamfatale-science/ , this is a category, with twentyfourteen, you should see the more tag.I’m here if you wanna try.
p.s.
For now show the full content in posts list with customizr.Let me ask you this, with customizr if you go in a category (showing the full content for post lists) you can see the more tag right? You can’t see it just in “Blog” which is a custom page template with, I presume,
query_posts
.
So the problem could be related to this.Yeah that’s the problem. You could mention it before :P.
Look: https://codex.www.ads-software.com/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_BehaviorSo that’s what you have to do, since you want to use the more tag for all posts in that custom page:
- In your custom page template look for
query_posts(...)
(You use that, right?) - Make it become something like this:
<?php query_posts(<em>query_args</em>); global $more; // Declare global $more (before the loop). $more = 0; // Set (inside the loop) to display content above the more tag. ?>
This should work.
Let me knowI am not experienced in php, so I copy here the template (called blog.php), pls do the suggested modification than I will upload the modified file:
<?php
/*
* Template Name: Blog Posts
* @package Customizr
* @since Customizr 3.0.12
*/
?><?php do_action( ‘__before_main_wrapper’ ); ##hook of the header with get_header ?>
<?php tc__f(‘rec’ , __FILE__ , __FUNCTION__ ); ?>
<div id=”main-wrapper” class=”container”><?php do_action( ‘__before_main_container’ ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)…and whatever you need! ?>
<div class=”container” role=”main”>
<div class=”row”><?php do_action( ‘__before_article_container’); ##hook of left sidebar?>
<?php query_posts(‘post_type=post&post_status=publish&posts_per_page=10&paged=’. get_query_var(‘paged’)); ?>
<div class=”<?php echo tc__f( ‘__screen_layout’ , tc__f ( ‘__ID’ ) , ‘class’ ) ?> article-container”>
<?php do_action (‘__before_loop’);##hooks the header of the list of post : archive, search… ?>
<?php if ( tc__f(‘__is_no_results’) || is_404() ) : ##no search results or 404 cases ?>
<article <?php tc__f(‘__article_selectors’) ?>>
<?php do_action( ‘__loop’ ); ?>
</article>
<?php endif; ?><?php if ( have_posts() && !is_404() ) : ?>
<?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
<?php the_post(); ?>
<article <?php tc__f(‘__article_selectors’) ?>>
<?php
do_action( ‘__loop’ );
?>
</article>
<?php endwhile; ?><?php endif; ##end if have posts ?>
<?php do_action (‘__after_loop’);##hook of the comments and the posts navigation with priorities 10 and 20 ?>
</div><!–.article-container –>
<?php wp_reset_query(); ?>
<?php do_action( ‘__after_article_container’); ##hook of left sidebar?>
</div><!–.row –>
</div><!– .container role: main –><?php do_action( ‘__after_main_container’ ); ?>
</div><!–#main-wrapper”–>
<?php do_action( ‘__after_main_wrapper’ );##hook of the footer with get_get_footer ?>
posted twice ??
Alright. Could you use backticks when you paste code? Is more readable. Or use the code button you see above the text area.
So make this line:<?php query_posts('post_type=post&post_status=publish&posts_per_page=10&paged='. get_query_var('paged')); ?>
become this:
<?php query_posts('post_type=post&post_status=publish&posts_per_page=5&paged='. get_query_var('paged')); // properly display more tag global $more; $more = 0; // change "more" text add_filter( 'the_content_more_link', 'my_more_link', 10, 2 ); function my_more_link( $more_link, $more_link_text ) { // standard customizr "more" for the content, change this string if you want, e.g. => $custom_more = "Read more..." ; $custom_more = __( 'Continue reading <span class="meta-nav">→</span>' , 'customizr' ); return str_replace( $more_link_text, $custom_more, $more_link ); } ?>
p.s.
sorry ” → ” is parsed, you should use this in your code: & rarr ; without spaces.
https://right-arrow.net/Of course, remember to select “show full content” for lists of posts.
You see that I don’t know the formatting buttons above ??
I did what you recommended, the blog.php looks like below. See the result on the page ??
`<?php
/*
* Template Name: Blog Posts
* @package Customizr
* @since Customizr 3.0.12
*/
?><?php do_action( ‘__before_main_wrapper’ ); ##hook of the header with get_header ?>
<?php tc__f(‘rec’ , __FILE__ , __FUNCTION__ ); ?>
<div id=”main-wrapper” class=”container”><?php do_action( ‘__before_main_container’ ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)…and whatever you need! ?>
<div class=”container” role=”main”>
<div class=”row”><?php do_action( ‘__before_article_container’); ##hook of left sidebar?>
// properly display more tag
global $more;
$more = 0;// change “more” text
add_filter( ‘the_content_more_link’, ‘my_more_link’, 10, 2 );
function my_more_link( $more_link, $more_link_text ) {
// standard customizr “more” for the content, change this string if you want, e.g. => $custom_more = “Read more…” ;
$custom_more = __( ‘Continue reading <span class=”meta-nav”>→</span>’ , ‘customizr’ );
return str_replace( $more_link_text, $custom_more, $more_link );
}?>
<?php query_posts(‘post_type=post&post_status=publish&posts_per_page=10&paged=’. get_query_var(‘paged’)); ?>
<div class=”<?php echo tc__f( ‘__screen_layout’ , tc__f ( ‘__ID’ ) , ‘class’ ) ?> article-container”>
<?php do_action (‘__before_loop’);##hooks the header of the list of post : archive, search… ?>
<?php if ( tc__f(‘__is_no_results’) || is_404() ) : ##no search results or 404 cases ?>
<article <?php tc__f(‘__article_selectors’) ?>>
<?php do_action( ‘__loop’ ); ?>
</article>
<?php endif; ?><?php if ( have_posts() && !is_404() ) : ?>
<?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
<?php the_post(); ?>
<article <?php tc__f(‘__article_selectors’) ?>>
<?php
do_action( ‘__loop’ );
?>
</article>
<?php endwhile; ?><?php endif; ##end if have posts ?>
<?php do_action (‘__after_loop’);##hook of the comments and the posts navigation with priorities 10 and 20 ?>
</div><!–.article-container –>
<?php wp_reset_query(); ?>
<?php do_action( ‘__after_article_container’); ##hook of left sidebar?>
</div><!–.row –>
</div><!– .container role: main –><?php do_action( ‘__after_main_container’ ); ?>
</div><!–#main-wrapper”–>
<?php do_action( ‘__after_main_wrapper’ );##hook of the footer with get_get_footer ?>
- In your custom page template look for
- The topic ‘"more tag" doesn't work’ is closed to new replies.