• Resolved kiudex

    (@kiudex)


    My client wants to build a post template that has scroll anchor links to the recipe and video at the beginning of the page. The layout would be like this:

    # POST TITLE #
    # POST EXCERPT #
    # SCROLL LINKS (TO WPRM RECIPE / RECIPE VIDEO) #
    # A LOT OF #
    # POST CONTENT #
    # WPRM RECIPE #
    ## RECIPE CONTENT ##
    ## RECIPE VIDEO ##
    # … #

    My approach was to create an extra WPRM template that contains those links using block “Recipe Jump” and “Recipe Jump Video” and embed the template via Shortcode like this:
    [wprm-recipe id=“XXX” template=”recipe-anchor-buttons”]

    The shortcode requires a recipe ID in order to pull the info from the recipe connected to the post. We want this to happen dynamically but I realised that the post doesn’t have a relation with the recipe itself. I was expecting to find a meta field in the post’s post meta entries pointing to the recipe but there is nothing.

    I then found out that there is only a connection from the repipe (CPT “wprm_recipe”) to the post via meta key “wprm_parent_post_id”.

    Now my questions: Is there a way to have a meta key “wprm_child_post_id” in the post (CPT post) which automatically stores the recipe ID inside the post?
    If a meta key in the post is not an option, how else would I be able to query the recipe ID inside a post?

    My client has the elite bundle and right now we are on version 6.2.0 in our development environment.

Viewing 1 replies (of 1 total)
  • Plugin Author Brecht

    (@brechtvds)

    We actually have that feature already built in:
    https://demo.wprecipemaker.com/recipe-snippets/

    The easiest way is to enable “Automatic Snippets” on the WP Recipe Maker > Settings > Recipe Snippets page, which will automatically output the snippet template (as defined in those same settings). Alternatively you can put the [wprm-recipe-snippet] shortcode in your theme files which will automatically output that snippet template if there’s a recipe on the page.

    This would be how to get the recipe ID through code, by the way:
    https://help.bootstrapped.ventures/article/110-access-recipes-in-a-post-via-code

    But you should NOT use the [wprm-recipe] shortcode for this. That shortcode is meant to represent a full recipe and will also output metadata.

Viewing 1 replies (of 1 total)
  • The topic ‘Relation from Post to Recipe’ is closed to new replies.