I'm trying to show at the category page only the content of the post that is before the <!--more--> tag. I'm using the latest Wordpress version.
In other words the structure will go like this
Content
<!--more-->
Content I want to be removed and only shown if the single post is displayed.
I've already got rid of the "Read More" link, and I've already tryed to use CSS and display:none; but none of those works fine
The code generated by wordpress is the following
<h2 class="entry-title">Post Name</h2>
<div id="chan" class="blanco">Content Shown</div>
<p><span id="more-50"></span>Post description.</p>
At the index.php I've managed to make it work since it shows the link and not the content itself, however in the page.php doesn't work.
Thank you very much in advance!
<?php the_content(); ?> will output the content, trimmed to just before the <!-- more --> tag, if the tag is used.
From the codex:
If the quicktag <!--more--> is used in a post to designate the "cut-off" point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-permalink post pages.
Related
I'm using the previous_post_link & next_post_link to display links to next & prev articles on a post single page. This works fine and the code I'm using is like this:
<div class="previous-article">
<h4>Previous Article</h4>
<?php previous_post_link('%link'); ?>
</div>
<div class="next-article">
<h4>Next Article</h4>
<?php next_post_link('%link'); ?>
</div>
Is there a statement I can use to hide / not display the 'Next' article link on the latest blog post because there is no 'next' so it display a blank entry (meaning that I can also hide the h4 headings I have in place) e.g.
So it looks like this:
And visa versa for the oldest post showing the 'Previous' article. Another solution would be to incorporate the heading into the php previous_post_link / next_post_link code. Maybe add class 'latest', 'oldest' to the body tag and I can hide using css. Is this possible?
Thanks
I should have searched better. For anyone else looking here is the solution to this how to get next/previous post hrefs and titles in wordpress
I am using wordpress eduma Learn press plugin. The courses page excerpt box is there but text is not displaying. can you please help me? Other pages meta tags is displayed
Add below code in your theme
add_post_type_support('page', 'excerpt');
So is the problem that when viewing the page, the whole content is shown instead of just an excerpt?
If so, try to find the appropriate theme file and if it uses:
the_content();
replace it with:
the_excerpt();
So this seems to not work on wordpress, any reason why this might be happening, I am using Advanced Custom Fields plugin and every custom field shortcode I have used in my content editor which is executed using the_content(); is working perfectly fine. even shortcodes in <a href=""> tags.
But for some reason this one gets ignored, if I take it out of the style="" and test it, I get the image URL value, but in the background-image: attribute I get no value.
<header class="docs-main" style="background-image: url('[acf field='header-background-image']');">
</header>
On a mobile version of my site, I want to ignore the tag and display the full text of every post. How can I do this? This cuts off the text and inserts (more...):
<?php the_content(); ?>
In your PAGE.PHP underneath this code you are using EXCERPT function, either remove EXCERPT from there.
I would like to display the posts the way they are shown when you have "show latest post" selected under reading settings.
I've tried using query_posts, but that displays the whole post, not the chunk that appears in the preview with the link at the bottom.
any ideas what I should be querying to get that?
Edit
I forgot to mention
I tried using the_excerpt(), but that doesn't show the image in the post. Also the index.php file is using the the_content() and it's displaying it the way I want it to
If you don't want to show the whole post, you should use the_excerpt() instead of the_post()
Edit:
From codex:
<?php the_content('Read more...'); ?> Displays the content of the post and uses "Read more..." for the more link text when the Quicktag is used.
Basically, use the_content('your text for the link') and add the quicktag to your article, this will automatically just show the text before