Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #675728

    Hello I’m using the blog grid module inside a page and I wish to add meta from the single blog post to this grid when it’s displayed.
    How can I do this?

    I need to be able to fetch the meta from the single post to show it in the loop of the grid.

    #677145

    Hey grafixstudio,

    not sure what you want to achieve. Can you send us precise links showing the elements you are talking about please?

    Best regards,
    Andy

    #679460

    Yes, it’s on this website and all of it’s sub-pages

    I want to display a custom field within the box (post).
    The custom field is of course set inside the original post.

    How do I do that?

    #679597

    Hi,

    about which custom field are you talking about? can you highlight using screenshots please? use imgur.com or dropbox.

    Best regards,
    Andy

    #679616

    The key: http://imgur.com/a/vD1rx
    I want it visible here: http://imgur.com/a/wFgkb

    #679661

    Hi,

    does it work for you when using a default WordPress theme?

    Best regards,
    Andy

    #679733

    You misunderstand

    I need to know what file I need to edit and insert the field. I have managed to insert it in the single.php file, but I also want to show the price in the front so I need to know what file controls the grid blog layout.

    <?php echo get_post_meta( get_the_ID(), 'pris', true );?>

    This is what I’ve put in the single.php. Where do I put it so it shows up like the picture I sent you?

    Do you get me?

    #680606

    Any answer?

    #681310

    Hi,

    Please go to Enfold/config-templatebuilder/avia-shortcodes/postslider.php file and find

    					$output .= !empty($excerpt) ? "
    <div class='slide-entry-excerpt entry-content' $markup>".$excerpt."</div>
    " : "";

    and change it to following

    					$output .= !empty($excerpt) ? "
    <div class='slide-entry-excerpt entry-content' $markup>".$excerpt."</div>
    " : "";
    					$output .= get_post_meta( get_the_ID(), 'pris', true ); 

    If you are using a child theme, please see – http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/

    Best regards,
    Yigit

    #683030

    Yes, I did this now but nothing happens?

    #683170

    Hi,

    Well, then there might be the issue in the way you are adding a custom field. Have you considered using Advanced Custom Fields plugin instead?

    Best regards,
    Yigit

    #683674

    I’m using a plugin called AccessPress Anonymous Post Pro and that is what I need to use. It generates the key called “pris”
    But really, is it correct to just type in: $output .= get_post_meta( get_the_ID(), ‘pris’, true ); ??

    This is supposed to show the price on the front page. Where in this code does it fetch the information from the post in question?

    Example: First column is a preview, an excerpt. Inside this post are all the keys, right?

    With the code above, nothing is saying “get the information from inside the post”.

    Do you know what I mean?

    • This reply was modified 8 years, 3 months ago by grafixstudio.
    #684838

    Hey!

    The get_post_meta function should fetch any custom or meta fields of a post. https://developer.wordpress.org/reference/functions/get_post_meta/

    If the function is not working, ask the plugin author what function to use to get the value of the field.

    Cheers!
    Ismael

    #684942

    Hey, they told me to contact you again.
    I believe they are right….

    Guys, listen…the keys work fine..If you check inside a post: http://dentalmarknaden.se/utrustning/mobiltelefon/ you will see where it says:

    “Pris 1200kr”

    That’s the value of the field pris that we are talking about. So it works. But not in the post-slider. So it’s inside Enfold where the problem is….

    #688051

    Hi,

    Which function did they use to get the value of the “pris” meta field? And did you add excerpts to the posts? If not, please edit one of the posts with the “pris” meta field then input something in the Excerpt module. If you can’t find the Excerpt module, enable it in the Screen Options.

    Best regards,
    Ismael

    #689782

    Hello

    I resolved the issue. the thing is that inthe postlider.php you have already declared a variable for get_the_id() – called $the_id

    So the correct code is:
    $output .= get_post_meta($the_id, 'pris', true );

    • This reply was modified 8 years, 3 months ago by grafixstudio.
    #690152

    Hi,

    Great, glad you got it working and thanks for sharing the solution :-)

    Please let us know if you should need any further help on the topic.

    Regards,
    Rikard

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