Skip Navigation

[Resolved] Add text to page via Pages > Home – echo types_render_field

This support ticket is created 4 years, 12 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Author
Posts
#1633159
Screenshot 2020-05-21 at 12.44.05.png
Screenshot 2020-05-21 at 12.40.05.png
Screenshot 2020-05-21 at 12.39.29.png
Screenshot 2020-05-21 at 12.38.51.png

Hi, I just downloaded toolset.

I used to add the <p><?php echo types_render_field( "home-testimonial", array( ) ); ?></p> into the <p></p> on the page and then create a new taxonomy called 'home-testimonial' and select toolset's WYSYWIG, so when I go into Pages > Home, there is a text box, where I enter the text for the p tag.

This has not worked. Nothing appears in the p tag on the page.

The link to my site is: hidden link

Site details:
user
!dimitri2020

It is the testimonial row further down, you can see that there should be some text in there, but its empty.

I used to do this with the tool set plug-in back in 2016, and in Pages > Home there would be a big text box for me to add the testimonial text into. That is what I am trying to do. This is the call I used to use: <?php echo types_render_field( "home-testimonial", array( ) ); ?>

Dimitri.

#1633285

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can use the standard WordPress function to display the terms assigned to post.

For example:

$post_terms = wp_get_object_terms( $post_id,'home-testimonial');
  if ( ! empty( $post_terms ) ) {
    if ( ! is_wp_error( $post_terms ) ) {
        foreach( $post_terms as $term ) {
          echo esc_html( $term->name);
        }
    }

or
You can use the view's shorcode:

echo do_shortcode('[wpv-post-taxonomy type="home-testimonial" separator=", " format="link" show="name" order="asc"]');
#1633389
Screenshot 2020-05-21 at 15.04.25.png
Screenshot 2020-05-21 at 15.00.04.png

Hi Minesh,

Thanks for the tip.

By the way I hadn't added a field with WYSYWIG earlier, but I have created that now and I can see the text box in 'Pages > Home', which is good.

So I need to add this call to my homepage code (html) homepage.php.

Is this correct?
<?php echo do_shortcode('[wpv-post-taxonomy type="home-testimonial" separator=", " format="link" show="name" order="asc"]'); ?>

So it will need to look like this:
<p><?php echo do_shortcode('[wpv-post-taxonomy type="home-testimonial" separator=", " format="link" show="name" order="asc"]'); ?></p>

I will have to add many of these <?php echo ?> calls around <p> <h2> and <h1> in my site.

I think I am not adding the code correctly.

Please see screenshot after I added the above code.

Dimitri.

#1633407

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you are using blocks, then you can add a Fields and Text block and add the following shortcode to it.

[wpv-post-taxonomy type="home-testimonial" separator=", " format="link" show="name" order="asc"]

If you are using PHP template- then:

echo do_shortcode('[wpv-post-taxonomy type="home-testimonial" separator=", " format="link" show="name" order="asc"]');