Hijack WordPress Shortcode attribute

You have several options, but I would advise against what you’re doing, what you really need is to make a new shortcode that calls the plugins functions to achieve what you want ( or to use a plugin that provides a filter ): 1. Search Replace on the Post Content Hook into the_content filter, and … Read more

How to check if a post has any one of many shortcodes?

So yes, as you say you can’t pass an array to has_shortcode, which is confirmed in the docs, so you need to do the ‘OR’ operation manually, which would look something like this: $shortCodesToTest = [ ‘wpdocs-shortcode-1’, ‘wpdocs-shortcode-2’, ‘wpdocs-shortcode-3’]; $anyShortCode = false; foreach ($shortCodesToTest as $sc) { if (has_shortcode( $post->post_content, $sc) ) { $anyShortCode = … Read more

List all blogs, but exclude the main site

I’ve never used it, but it looks like get_main_site_id is what you want to figure that out, so therefore your code might look like: $mainSiteId = get_main_site_id(); foreach ($user_blogs AS $user_blog) { if ($userblog->site_id != $mainSiteId) { echo ‘<li><a href=”‘.$user_blog->siteurl.'”>’.$user_blog->blogname.'</a></li>’; } }

A shortcode nested inside a shortcode

This should work: function cpa_haven_banner() { $shortcode = do_shortcode(“[get_sheet_value location=’LOAN!B7′]”); return ‘ <ul class=”list-group list-group-horizontal entry-meta”> <li class=”list-group-item list-group-action-item”> <strong>Female</strong> ‘ . $shortcode . ‘</li> </ul> ‘; } add_shortcode(‘cpa-haven’, ‘cpa_haven_banner’);

shortcode not return any thing in Gutnburg

There are 2 major bugs here Problem 1: Your shortcode registration is invalid You should be seeing lots of messages about this in your PHP error log add_shortcode(‘splite’, ‘splite_article’); There is no function named splite_article, there’s a class function but the code didn’t tell it to use it. So instead of calling your shortcode function, … Read more