Navigation überspringen

[Gelöst] Bracket displayed near every image gallery

This support ticket is created vor 6 Jahren. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Dieses Thema enthält 4 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von francescoG-3 vor 6 Jahren.

Assistiert von: Christian Cox.

Author
Artikel
#1185094

Hi Christian,
thanks for more shortcode it work fine and now the page looks like Profile CPT post.

But it don't work to display the "Sono di - Mio Profilo" View that it should display the current user position. I have duplicated all relative Content Template and add to the title name the " - Mio Profilo" string, and added to the shortcodes the "wpv-post-id", but nothing.

Other issue is in the gallery, I don't know why near the images are displayed "']" for every single image.

Now I'm trying to adeguate the shortcode to display the age and the category lists.

#1185232

Hi, check now. I have removed the id attribute from the wpv-for-each loop, and replaced some square brackets with the curly bracket syntax:

<p style="text-align: center;">
{!{wpv-for-each field='wpcf-galleria'}!}
  <a href="[types field='galleria' size='full' url='true' separator=',' id='[wpv-post-id]'][/types]" rel="lightbox">
    [types field='galleria' alt='%%ALT%%' title='%%TITLE%%' width='240' height='170' align='left' resize='crop' separator=', ' id='[wpv-post-id]'][/types]
  </a>
  <br>
{!{/wpv-for-each}!}
</p>
#1185294

Hi, thanks, now the gallery is displayed fine.

So, now I don't know how to display the correct vlues with my custom shortcodes...

To display the age into the Profile CPT post I use this code, but what snipped permit to display the correct age into the Page?

add_shortcode( 'iam-eta', 'wpv_post_age_shortcode');
function wpv_post_age_shortcode( $atts ) {
   global $post;
 $timestamp = get_post_meta( $post->ID, 'wpcf-data-di-nascita', true );
$age = floor((time() - $timestamp) / ( 60*60*24* 365 )) ;
return $age;
}

To display the category list in the Profile CPT post I use this code, but what code permit to display the category list in the page?

// Add Shortcode
function attivita_incontramici() {
$terms = get_the_terms($post->ID, 'attivita');
$count = count($terms);
if ( $count > 0 ) {
    foreach ( $terms as $term ) {
        $result .= "<li><span class='logo-serv'>" . $term->name . "</span></li>";
    }
}
return "<ul class='servizi'>" . $result . "</ul>";
}
add_shortcode( 'attivita', 'attivita_incontramici' );

Neue Threads, die von Christian Cox erstellt wurden und mit diesem verbunden sind, sind unten aufgeführt:

https://toolset.com/de/forums/topic/how-to-display-information-from-a-custom-post-in-a-custom-shortcode/

#1185334

Our policy is to address one issue per ticket, so please create new tickets for each new issue. I have split this new issue into another ticket for you.

#1186030

My issue is resolved now. Thank you!