Skip Navigation

[Resolved] Loop title issue

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the customer wanted to trim the text that the [wpv-post-title] shortcode provides.

Solution:

In order to do this it will require some custom shortcode.

// Add Shortcode
function trim_link( $atts ) {
 
    // Attributes
    $atts = shortcode_atts(
        array(
            'string' => '',
            'length' => '',
            'url' => '',
        ),
        $atts
    );
 
    if (strlen($atts['string']) > $atts['length']){
        $shortened_text = substr($att['string'], 0, $atts['length']);
        return "<a href='".$atts['url']."'>".$shortened_text."...</a>";
    }else{
        return "<a href='".$atts['url']."'>".$atts['string']."</a>";
    }
     
 
}
add_shortcode( 'trim_link', 'trim_link' );

Add it to your functions.php file and then you can add it to your view by doing this.

[trim_link string='[wpv-post-title]' length='140' url='[wpv-post-url]'] 

Please try this and let me know if it helps.
Thanks,

This support ticket is created 6 years, 1 month 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 44 replies, has 3 voices.

Last updated by Anonymous 6 years ago.

Assisted by: Shane.

Author
Posts
#631182

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simone,

You can still have the pagination but not an AJAX pagination. The non-ajax pagination would refresh the entire page.

#631322

Anonymous

So, I still wait for an ajax fix.

#644386

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Thanks for the extreme patience.

I've managed to resolve the issue and it should be working as intended now.

Thanks,
Shane

#644409

Anonymous
download.jpg

Hi, now it works! You're an angel.

1) what did you edit to succed?

2) why there are 2 blank tiles now?

#645091

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simone,

Not sue why there are 2 blank tiles, but I suspect that its coming from one of the conditional criteria not being met so I would recommend checking the posts to see which ones are missing and then check the criteria.

Secondly it was caused by the url information not being closed correctly in the shortcode.
What I had

return "<a href=".$atts['url'].">".$shortened_text."...</a>";

What it should've been

return "<a href='".$atts['url']."'>".$shortened_text."...</a>";

Thanks,
Shane

#645231

Anonymous

I checked and I found that the 2 posts missing are:
hidden link
and
hidden link

The last one was visible in some of my first screenshots of this ticket, though.

I really didn't understand why they are missing, I need an help to fix this.

#650302

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-04-11 at 3.52.25 PM.png

Hi Simone,

I took a look at this for you and it seems that you needed to have set a primary category. See Screenshot
Once you've set the primary category it should start showing up.

Thanks,
Shane

#650458

Anonymous

Now this post has a primary category set
hidden link

But it still not appears here
hidden link

#652865

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simone,

Yes it does but your condition in views is checking for Reparto Campanile Rosso or Reparto Stella Polare I'm not seeing where the conditionals are checking for Branca E/G as a primary category.

You need to set Reparto Campanile Rosso or Reparto Stella Polare as one of the Primary in order for it to show up based on your conditional statement

Thanks,
Shane

#653086

Anonymous
download.jpg

Here

#653612

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simone,

This is really strange as the conditional is working as intended.

Could you try recreating this post ?

Thanks,
Shane

#654047

Anonymous

What do you mean? Of you need to test you can create new one but at the end I need to show THIS true post.

#657626

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simone,

I meant that you should delete this post that is not showing and remake it. It could be that something is wrong with it.
Thanks
Shane

#658276

Anonymous

Absolutely not.

There are already analytics on it.

I cannot do this.

I just need a fix since I did nothing wrong.

#658902

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simone,

There seems to be somethhing wrong with the conditionals as only the first instance category of the Branca E/G is working any other items assigned to that category doesn't work.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.