Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
Yohanndev83
tagDiv Member

To continue this thread, here’s how I managed to achieve what I wanted.

In my custom module, I added an element of the “Column Title” type from the “Multipurpose shortcode” category, and in the title, I placed “foobar”.
Then, in the plugin file td-composer : td_multi-purpose/shortcodes/tdm_block_title_simplified.php,
I modified line 56 with the variable $buffy.
If I detect the title “foobar”, then I use do_shortcode() and call my function to add a dynamic element.
This works on the front-end, no regression, BUT it remains unstable when editing in the back-office. I will need to add a condition: if back-office, do not load do_shortcode(). Nothing difficult, but not urgent for me.

The code is well-documented, and for future updates, I’ll just need to be careful.

Yohanndev83
tagDiv Member

Thank you for your response.
Maybe I can modify an existing element to make it use my shortcode? My goal is to display dynamic content in addition to the default content that will appear in this module (title, excerpt, image, date) inside a loop
For example, the “Column Title” element from “Multipurpose shortcodes”—where can I find the PHP file or code to modify it? I have tried searching in td-composer folder without success.
Thank you

Yohanndev83
tagDiv Member

Hi,
I needed for my plugin, and using an additional module on template will probably delay execution.
For thoses who need this is what I used :
url_to_postid($_SERVER[‘REQUEST_URI’]) <= single post
get_page_by_path($_SERVER[‘REQUEST_URI’]) <= page
Thank you.

Yohanndev83
tagDiv Member

For those who are interested in a solution
The function that manages it is called get_excerpt() line 795 of the file
plugins/td-composer/legacy/common/wp_booster/td_module.php
if ($this->post->post_excerpt != '') {
return $this->post->post_excerpt." foobar";
}

It remains to manage the problem during the update. But one thing at a time.
Regards

Yohanndev83
tagDiv Member

Right, that the part I missing in the blue box, thank you.
Problem for me now is historical the Excerpt field is used for SEO purpose in head meta page. So I need a way to shrink it for displaying in elements on the homepage. Is there way to make a Hook to change the behavior without modified the TagDiv Composer plugin ? it will be nice

Yohanndev83
tagDiv Member

Hi,
Well, I’m missing something then.
I took 2 screenshots here and highlighted where I work
https://postimg.cc/gallery/XVs8F8v
1: Flex Block 5 > Excerpt length: 1 (type theme panel parameters: “On letters” / but “On words” do the same result)
2: Article presented with excerpt used

Can you guid me where is,in TagDiv Composer, the file who is used for this flex block. I will try to test with php the output

thank you
Regards

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