Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1259024

    Hello, I have added a field to the blog posts to be seen in the posts. Where can I find the masonry php file to add that field

    #1259168

    Hey jeiceta,

    I’m not sure I understand your question, could you try to explain a bit further, or post a screenshot highlighting your intentions please?

    Best regards,
    Rikard

    #1259437

    Hello, I have added a field to the blog posts. On the blog page I put the content element that you see in image1. And on the web it looks like in the image2. I want it to look like in image 3 where I have added the year field (it could be another). In which file (php or other) can I add that field?
    Imagen1
    imagen1
    Imagen2
    imagen2
    Imagen3
    imagen3

    #1260036

    Hi,

    Thank you for the inquiry.

    We have to modify the enfold\config-templatebuilder\avia-shortcodes\postslider\postslider.php file and add the year above the featured image markup, which is around line 772 of the said file.

    $output .= $thumbnail ? "<a href='{$link}' data-rel='slide-" . avia_post_slider::$slide . "' class='slide-image' title='{$image_link_title}'>{$thumbnail}</a>" : '';
    

    Did you add the year as a custom field? If so, then we could use the get_post_meta function to get the value of the custom field and render it in the page.

    // https://developer.wordpress.org/reference/functions/get_post_meta/

    Best regards,
    Ismael

    #1260041

    Hello, thanks for your answer. I put this code “echo get_field (“Date”);” How would I put it where you indicate?

    #1260557

    Hi,

    Thank you for the info.

    Above the code that we mentioned above, try to add this line.

    $year = get_field ("Date");
    $output .= "<span class='slide-year-meta'>".$year."</span>";
    

    This should render the Date above the featured image. We could then use the .slider-year-meta selector to adjust the style of the year info.

    Best regards,
    Ismael

    #1260607

    Hello, thank you agani. Now the field appears. But the date (the field) of the first post is repeated in the rest. That is, it only puts a single date, that of the first post published in all posts. It does not take the one from each field.

    #1260609

    Is a text field

    #1261464

    Hi,

    Thank you for the update.

    We may have to add the post ID to the get_field function so that it returns the actual year from each post. Please look for the line where we defined the $year variable and replace it with the following code.

    $year = get_field ("Date", $entry->ID);
    

    // https://www.advancedcustomfields.com/resources/get_field/

    Best regards,
    Ismael

    #1261573

    Hello. Perfect. Works. It’s what I needed. Many thanks

    #1261574

    One more question. If I wanted to put it in the masonry widget, where would I have to put it?

    #1261575

    Hi,

    Glad Ismael could help! :)

    For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/

    If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)

    Enjoy the rest of your day!

    Best regards,
    Yigit

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘How to put a field in blog posts in masonry’ is closed to new replies.