• Resolved pablovillaverde

    (@pablovillaverde)


    First, sorry for my english.

    I´m making a page of real state building with an slider. The modified post type have field for add images, but can´t show the correct images.

    I have this code on php template for getting a img url for the slide. If I put the id (109) manually it gets the correct image, but if I put id=”ID” don´t get any image.

    <div class="p-slide js-slide" style="background-image: url('<?php echo do_shortcode( '[pods name="post" id="109" template="promociones"]{@slider_1}[/pods]' ); ?>');">

    How can i get post id here?

    <div class="p-slide js-slide" style="background-image: url('<?php echo do_shortcode( '[pods name="post" id="ID" template="promociones"]{@slider_1}[/pods]' ); ?>');">

    Thanks in advance.

    Pablo

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support pdclark

    (@pdclark)

    Instead of id="109", use use_current_id="1".

    This will use the current ID within the loop.

    Thread Starter pablovillaverde

    (@pablovillaverde)

    Hi Paul, thanks a lot for your answer but sadly it doesn’t work.

    I replace:
    <?php echo do_shortcode( '[pods name="post" id="109" template="promociones"]{@slider_1}[/pods]' ); ?>
    for:
    <?php echo do_shortcode( '[pods name="post" use_current_id="1" template="promociones"]{@slider_1}[/pods]' ); ?>

    Thanks in advance!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @pablovillaverde

    It should be use_current=1.
    Alternatively you can just omit the name parameter like so:
    <?php echo do_shortcode( '[pods template="promociones"]{@slider_1}[/pods]' ); ?>.

    Also, since you use the template parameter you can remove the shortcode content and just do this:

    <?php echo do_shortcode( '[pods template="promociones"]' ); ?>

    Cheers, Jory

    Thread Starter pablovillaverde

    (@pablovillaverde)

    Thanks a lot Jory, it works!!

    Best regards!!!!

    Plugin Author Jory Hogeveen

    (@keraweb)

    You’re welcome! The best way to say thanks is to leave a 5 star review at https://ww.wp.xz.cn/plugins/pods/ and (if you’re feeling especially generous) become a Friend of Pods at https://friends.pods.io/

    Cheers, Jory

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Get field from post’ is closed to new replies.