Is it possible to make shortcodes NOT case sensitive?

Here is another simple idea for a case-insensitive shortcode: /** * Make a shortcode case insensitive via the the_content filter * * @param string $content * @return string $content */ function my_case_insensitive_shortcode( $content ) { $sc=”test”; // Edit this shortcode name to your needs $from = ‘[‘. $sc ; $to = $from; if( stristr( $content, … Read more

Change font-size within a shortcode

Are you trying to put a shortcode within a shortcode? Perhaps this is an easier solution to control your front-end output? CSS span.my_pixel_size{font-size:25px;} PHP ‘<p>This is the content: <span class=”my_pixel_size”>’ . $content . ‘</span></p>’;

How best to apply do_shortcode in media.php for captions

Caption shortcode attributes are merged with defaults using shortcode_atts function like so (see source in media.php): $atts = shortcode_atts( array( ‘id’ => ”, ‘align’ => ‘alignnone’, ‘width’ => ”, ‘caption’ => ”, ‘class’ => ”, ), $attr, ‘caption’ ); So the 3rd $shortcode param is in use with the value of ‘caption’. As you can … Read more

Shortcode doesn’t work with classes

Here’s a simple example using your original code that successfully registers the shortcode. You need to instantiate the Loader class, then call its activate() method. class Shortcodes { public static function notifications_shortcode( $atts, $content = “” ) { return ‘notifications foo foo’; } } class MvcPluginLoader { function __construct() { } } class Loader extends … Read more

Pass shortcode variables to template

You can’t just stick a shortcode somewhere and expect it to do something. It’s basically an buffer that will take whatever code it’s told to generate, compile it exactly how you tell it to, and then output it wherever the shortcode is placed. Take a look at the Shortcode API for more information. As for … Read more

Loading page template into shortcode

get_template_part takes slug as first parameter and not filename. So it should be: get_template_part( ‘template-sponsors’ ); And with more details… This function takes two parameters: get_template_part( string $slug, string $name = null ) And inside of it, the name of a file is built like this: if ( ” !== $name )         $templates[] = “{$slug}-{$name}.php”;       $templates[] = “{$slug}.php”; So, … Read more

Adding span tags within wp_list_pages list items

There is more than one way to accomplish this in WordPress. Option 1: Using the link_before parameter with wp_list_pages. $childpages = wp_list_pages( array( ‘sort_column’ => ‘menu_order’, ‘title_li’ => ”, ‘child_of’ => $parent_id, ‘echo’ => 0, ‘link_before’ => ‘<span class=”fa-li”><i class=”fas fa-spinner fa-pulse”></i></span>’ ) ); Option 2: Create a custom walker, then add the walker parameter … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)