We're merging with GenerateBlocks! Learn more here.

[Resolved] Excerpts under featured image

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Excerpts under featured image

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7670
    John
    Participant

    can you have a custom description there?

    is this a feature?

    Say i wanted it to say “if you want to find out more about x y and z, read this post” or something

    #7705
    Tom
    Keymaster

    Hey John,

    You can likely use the hooks for this.

    For example, if you had a custom field for each post, you could output that field like this:

    add_action( 'wpsp_before_content', function() {
        $text = get_post_meta( get_the_ID(), 'your_custom_field', true );
    
        if ( $text ) {
            echo $text;
        }
    }, 20 );

    Let me know 🙂

    #10779
    Sarah
    Participant

    Hi Tom, I’ve used this answer and it works great. However, I would like to add a line break between the custom field value I’ve created and the Read More button. How can I do that? I’ve been searching online and it looks like \n may do it but I have no idea how to adjust the php code above. Can you help please?

    #10790
    Tom
    Keymaster

    Hey Sarah,

    You could wrap your text in a div:

    add_action( 'wpsp_before_content', function() {
        $text = get_post_meta( get_the_ID(), 'your_custom_field', true );
    
        if ( $text ) {
            echo '<div class="your-custom-class-name">' . $text . '</div>';
        }
    }, 20 );
    #10842
    Sarah
    Participant

    That works a treat! Thanks Tom 😀

    #10849
    Tom
    Keymaster

    You’re welcome 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.