-
AuthorPosts
-
August 22, 2016 at 2:00 pm #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.
August 24, 2016 at 5:27 pm #677145Hey grafixstudio,
not sure what you want to achieve. Can you send us precise links showing the elements you are talking about please?
Best regards,
AndyAugust 30, 2016 at 2:42 pm #679460Yes, 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?
August 30, 2016 at 5:29 pm #679597Hi,
about which custom field are you talking about? can you highlight using screenshots please? use imgur.com or dropbox.
Best regards,
AndyAugust 30, 2016 at 6:30 pm #679616The key: http://imgur.com/a/vD1rx
I want it visible here: http://imgur.com/a/wFgkbAugust 30, 2016 at 8:33 pm #679661Hi,
does it work for you when using a default WordPress theme?
Best regards,
AndyAugust 30, 2016 at 10:40 pm #679733You 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?
September 1, 2016 at 10:46 am #680606Any answer?
September 2, 2016 at 2:45 pm #681310Hi,
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,
YigitSeptember 7, 2016 at 8:51 am #683030Yes, I did this now but nothing happens?
September 7, 2016 at 2:43 pm #683170Hi,
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,
YigitSeptember 8, 2016 at 1:00 pm #683674I’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, 2 months ago by grafixstudio.
September 12, 2016 at 2:07 am #684838Hey!
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!
IsmaelSeptember 12, 2016 at 8:58 am #684942Hey, 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….
September 18, 2016 at 7:22 am #688051Hi,
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,
IsmaelSeptember 21, 2016 at 1:44 pm #689782Hello
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, 2 months ago by grafixstudio.
September 22, 2016 at 8:41 am #690152 -
AuthorPosts
- You must be logged in to reply to this topic.