Modifying read more link, but NOT for category 347

Community Forums Forums Design Tips and Tricks Modifying read more link, but NOT for category 347

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  cdils 2 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #12860



    /** Modify the Genesis content limit read more link */
    add_filter( ‘get_the_content_more_link’, ‘custom_read_more_link’ );
    function custom_read_more_link() {
    return ‘… <a class=”more-link” href=”‘ . get_permalink() . ‘”>[Continue Reading]</a>';


    I am using the above but I wish to exclude category #347 – what do I need to add please?





    Hi Jill,

    You can add a conditional statement to your code above. It’d look something like this

    add_filter( ‘excerpt_more’, ‘child_read_more_link’ );
    add_filter( ‘get_the_content_more_link’, ‘child_read_more_link’ );
    add_filter( ‘the_content_more_link’, ‘child_read_more_link’ );

    function child_read_more_link() {
    if (!is_category( ‘347’ ) || !in_category( ‘347’ ) )
    return ‘<a class=”more-link” href=”‘ . get_permalink() . ‘” rel=”nofollow”>Continue Reading…</a>';

    You can find a full list of WordPress conditional tags here: The is_category conditional checks to see if it’s the archive page for ‘347’ and the in_category checks to see if the current post is in category ‘347’. If either of those statements is false, it’ll return your customized read more link.



    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. :)

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

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

You must be logged in to reply to this topic.