WordPress.org

Ready to get started?Download WordPress

Forums

Manual Related Posts
Using Custom Field Instead of excerpt below title of related post (7 posts)

  1. amaykul
    Member
    Posted 1 year ago #

    I am trying to use the output from a custom field instead of the excerpt.

    I have managed to get the custom field showing below the title of the related posts. But the problem is the custom field takes the post ID of the current post instead of the related post.

    This is what I did, edited baw-manual-related-posts/inc/frontend-noajax.inc.php

    Replaced:
    case 'excerpt': $p = get_post( $id ); $_content = '<br />' . apply_filters( 'the_excerpt', $p->post_excerpt ) .'<p>&nbsp;</p>'; break;

    To:
    case 'excerpt': $p = get_post( $id ); $_content = '<br />' . get_custom_field_value('cp_base_pay', $p->post_excerpt ) .'<p>&nbsp;</p>'; break;

    I tried:
    case 'excerpt': $p = get_post( $id ); $_content = '<br />' . get_custom_field_value($postid, 'cp_base_pay', $p->post_excerpt ) .'<p>&nbsp;</p>'; break;

    But it doesn't seem to work.

    Someone please help.

    Thanks

    http://wordpress.org/extend/plugins/baw-manual-related-posts/

  2. amaykul
    Member
    Posted 1 year ago #

    would something like this work?

    case 'excerpt': $p = get_post( $id ); $_content = '<br />' . apply_filters( 'the_meta_key', 'CUSTOM_FIELD_NAME', $p->post_excerpt ) .'<p>&nbsp;</p>'; break;

  3. fab4_33
    Member
    Posted 1 year ago #

    hi,

    I'm trying to do the same, show a custom field below the thumb.

    I'm still trying !

    @amaykul
    Did you find a solution ?

  4. Jason Lemahieu (MadtownLems)
    Member
    Posted 1 year ago #

    You should be able to use the bawmrp_more_content filter to output what you want without hacking the plugin's code.

  5. s-design
    Member
    Posted 7 months ago #

    @Jason - I have a little knowledge about adding filters to my functions.php file in my child theme. Do I also add bawmrp_more_content filter to my functions.php child theme file, or do I do something different to customize plug-ins? I'm new to customizing plug-ins. Is there info in the codex about this, you could point me to?

    Thanks for any help you can offer.

  6. Jason Lemahieu (MadtownLems)
    Member
    Posted 7 months ago #

    Filters let you modify stuff WITHOUT customizing the plugin - that's basically why they exist :)

    Read this page, as it gives a good overview and provides some basic examples:

    http://codex.wordpress.org/Plugin_API

  7. s-design
    Member
    Posted 7 months ago #

    @Jason - Thank you for this help.

    If I put the bawmrp_more_content filter in my child themes functions.php file it should it be modifying the plugin? Is this the correct place to put this filter? I could never find anywhere that talked about this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic