Support

Account

Forum Replies Created

  • Field type is select, although I have tried radio buttons too.

    It’s set up as you have shown, and still no luck. :\

  • I have several different css classes set to call different backgrounds for the testimonials rotator depending on the page it is on.

    I’ve set the custom field so the client can choose the right colour for each rotator / page.

    The colour they choose is the name of the css class, so what I need it to do it print that name, so it can call the right css class.

  • I’m not trying to print it on the front end – I’m trying to get it to print so that it reads as a div class.

    The code you shared is from the testimonial plugin – I haven’t changed that at all – I just put it in so you could see part of it.

    Might you be able to email me please: hello@rebeccashortseo.co.uk as I would really appreciate you being able to take a proper look at it.

  • I’ve tried changing that to quite a few things, but the one that I think is probably right is

    Post Type is equal to testimonial_rotator

  • Sorry – I’ve just been trying to work out how to explain it to you, but I can’t really. :\

    The code you gave me worked, however I realised after putting it in that the variable was the wrong name. BUT it did manage to display the default value set in ACF for this variable. HOWEVER, when I changed the field name to the correct one, it went back to printing nothing.

  • That has helped slightly – thank you! It’s shown me that it can print from the ACF, but it is just displaying the default value for that field – so could it be that because it is an external plugin, that it can’t see which page it is on?

  • Sorry – I’ve been having problems explaining it! I’ll do my best to break down what I am trying to do.

    I’ve created a custom field type called testimonials, and set up a multiple choice for the specific colour.

    I have set the custom field type to display on the testimonials rotator section for the plugin.

    When you are in the testimonial rotator, you can choose which colour you want – so this part of the plugin is working fine.

    Within the section that is printing the testimonials on each page – which is in the file loop-testimonial in the actual plugin, I have tried added the code as above, with in mind that it will print the chosen colour. This will then set the css class, which has been set in styling.

    However, what I am getting when I do this is the following code printed:

    <div class=".get_field('header_bullets_and_testimonials_colour');">
    <div class="testimonial_rotator_quote">
    Quote goes here.</div>
    </div>

    The code I am inputting to the loop-testimonials.php file is

    echo "<div class=\".get_field('header_bullets_and_testimonials_colour');\">\n";
    echo "<div class=\"testimonial_rotator_quote\">\n";
    echo ($show_size == "full") ? do_shortcode(nl2br(get_the_content(' '))) : get_the_excerpt();
    echo "</div>\n";
    echo "</div>\n";
  • Code I am attempting to add in is:

    <div class="<?php the_field('header_bullets_and_testimonials_colour'); ?>">
    

    For the testimonials, and for the blog section it is

    `<?php

    $image = get_field(‘featured_image’);

    if( !empty($image) ): ?>

    <img src=”<?php echo $image[‘url’]; ?>” alt=”<?php echo $image[‘alt’]; ?>” />

    <?php endif; ?>`

    Both of which are working on other parts of the same WP install.

Viewing 8 posts - 1 through 8 (of 8 total)