append view shortcode to post titles

Support MB Views append view shortcode to post titlesResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #36160
    KellyKelly
    Participant

    I have a working php code saved in a view as a shortcode (it's rather long so thought this would keep my functions shorter.) I've tried various ways to append the shortcode to the post titles but nothing works. I've tried so many for hours so I'm giving up and asking for help. This was my last try...which is not close to being right, I'm guessing.

    function price_after_title($title,$post_id)
    { $price_after_t = rwmb_meta('price_after_title');
    return $title. $price_after_title_t;
    }
    add_action ('the_title', 'price_after_title_t);
    

    Help! Thanks 🙂

    #36173
    Long NguyenLong Nguyen
    Moderator

    Hi Kelly,

    Do you mean to add the view shortcode to the current view title?
    [mbv name="my-view"]
    Screenshot https://monosnap.com/file/08vYvCxq6b3ZvDtFfyxMZDfilpO6Mk

    #36182
    KellyKelly
    Participant

    To take a Views shortcode I created and append the shortcode to post titles with a function. Sorry for not being clearer.

    #36203
    Long NguyenLong Nguyen
    Moderator

    Hi Kelly,

    Does that mean adding the View shortcode to the title of the post that you added the View shortcode to the post content? https://monosnap.com/file/zOmIZbHezAEnJibaZHdOD4zwceqBh9

    #36222
    KellyKelly
    Participant

    No, I wanted to hook into post titles by a function using a Views shortcode within the function.

    #36224
    KellyKelly
    Participant

    Figured out another way to do it. Thanks anyway! 🙂

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