Add block programatically

Posted in: Newsmag
Post count: 44

Hi,

Is it possible to add the block shortcode programatically in a php file. I don’t want to use do_shortcode but echoing a function that generates the block.

So for [td_block_1 autors_id="2,3"] we can do so something like: <?php echo td_block_1(‘autors_id’ => ‘2,3’) ?>. The reason I want to do this is I need to get author id dynamically but I also want to use the built in blocks.

  • This topic was modified 8 years by shubhra.
Post count: 23312

Hello shubhra,

I guess that you want to add the author avatar for each post in blocks, right? So, if you want to do this, please check the following topic here -> https://forum.tagdiv.com/topic/adding-avatar-to-a-block/

Thanks for the message!

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.