Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #4415

    I have custom templates created for a few pages. These are set up to have a featured slider, followed by a text box, followed by a blog which draws from one category only. When I go to the page the blog will show all the posts in their full length – ignoring the read more tag I have placed after a couple of sentences.

    How can I get the read more tag to work on these blogs within pages?

    Thanks!

    #46237

    Hey,

    The Template Builder blog section should respect the More tag and only display the content you want it to.

    Can you post the URL for the page having the problem so we can see the code 1st hand?

    James

    #46238

    James,

    Any of the menu links in the main navigation (which link to pages) will show this – for example: http://www.biospablog.com/wellness-menu

    All of the blog posts are displayed in their entirety, ignoring the read more tag.

    When I originally had the main navigation link to a category instead of a page, the read more tag worked.

    #46239

    Hey,

    a)

    1) Make a copy of loop-index.php (located in the folder “includes”)

    2) Call the copy loop-indexcustom.php

    3) In loop-indexcustom.php change following code:

    the_content(__('Read more','avia_framework'));  ?>

    to:

    the_excerpt();
    echo "<a href='".get_permalink()."' class='more-link'>Read more</a>";
    ?>

    4) In includeshelper-templates.php replace:

    echo "<div class='template-blog content'>";
    get_template_part('includes/loop','index');

    with:

    echo "<div class='template-blog content'>";
    get_template_part('includes/loop','indexcustom');

    #46240

    Dude,

    The line: the_content(__(‘Read more’,'avia_framework’)); ?> in my copy of loop-index.php looks different.

    Mine reads: <?php the_content(‘<span class=”inner_more”>’.__(‘Read more’,'avia_framework’).’</span>’); ?>

    Is this the line I should replace with:

    the_excerpt();

    echo “Read more“;

    ?>

    #46241

    Hey,

    replace:

    <?php the_content('<span class="inner_more">'.__('Read more','avia_framework').'</span>'); ?>

    with:

    <?php the_excerpt();
    echo "<a href='".get_permalink()."' class='more-link'>".__('Read more','avia_framework')."</a>";
    ?>

    #46242

    I did the above, however it’s doing something other than what I want.

    It shows the first five lines of the post, but ignoring the POSITION of the read more tag. In other words when you click on the blog post, I have an H3 subtitle then an icon shortcode then the Read More tag followed by the blog post body.

    The code above is simply taking the first five lines of the body, ignoring the placement of the Read More tag.

    The Read More button is also looking off…

    You can see this here: http://www.biospablog.com/beauty-menu

    Any thoughts? It should be showing the H3 title and icon shortcode only if the Read More tag is working properly…

    Thanks!

    #46243

    If you want to control the excerpt length the standard code:

    <?php the_content('<span class="inner_more">'.__('Read more','avia_framework').'</span>'); ?>

    already does what you want. Very likely the problem is the html filter wordpress applies to excerpts. The filter strips out html tags to prevent formatting and display errors. Plugins like: http://wordpress.org/extend/plugins/advanced-excerpt/ help you to style the excerpt.

    #46244

    I have the same problem where on pages where I’m using a template from the template builder where I have added a blog element. The posts all show the entire post instead of honoring the <!–more–> tag. The regular blog page works fine and honors the <!–more–> tag.

    #46245

    Ok I actually just solved this myself. The includes/helper-templates.php file is missing the $more variable declaration and a $more = 0; in the blog function.

    Replace:

    function blog($element)
    {
    extract($element['saved_value'][0]);

    global $avia_config;

    with:

    function blog($element)
    {
    extract($element['saved_value'][0]);

    global $avia_config, $more;

    And replace:

    Code:
    echo “<div class=’template-blog content’>”;
    get_template_part(‘includes/loop’,'index’);

    with this:

    Code:
    echo “<div class=’template-blog content’>”;
    $more = 0;
    get_template_part( ‘includes/loop’, ‘index’ );

    #46246

    Thanks – I’ll report it to Kriesi.

    #46247

    ok, I am having the same problem, I am a little confused with all the posts, should I replace all the codes above to make it work? or Only some of them? Thanks

    #46248

    Hey,

    The code from this post should solve the problem for you, but look out for an update to the theme incorporating this if you’re unsure.

    James

Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘"READ MORE" tag not working on blogs within pages.’ is closed to new replies.