Shotcode argument issues

You need to pass $atts as parameter to the function. Also you don’t need to use extract() function and better you avoid this extract function as much as you can. So your whole code block will be- function some_function_bbb( $atts ) { $atts = shortcode_atts( array( ‘hexabexa’ => 0 ), $atts ); ob_start(); ?> <div … Read more

Random image loader

Try to see if this works, I used scandir because I prefer it. The problem was that glob, like scandir, only works with paths on the server’s file system, not URLs: function footer_image(){ $imagesDir = get_stylesheet_directory() . ‘/images/footer’; $imagesUri = get_stylesheet_directory_uri() . ‘/images/footer/’; $images = array_diff( scandir( $imagesDir, 1 ), array( ‘.’, ‘..’ ) ); … Read more

Function result goes outside div

You’re using a mix of echoing and returning. Here you’re starting by echoing: echo ‘<div class=”clear”></div>’; Here you’re putting the output into a variable (correctly): $output=”<div class=”row”>”; And here you’re just writing the content in quotes without echoing or assigning to a variable: ‘<div class=”col-md-8 grid-entry-wrapper”> <!– grid-entry-wrapper open –> <!– BLOG LOOP –> </div><!– … Read more

::before on open/close function [closed]

Your shortcode return text. Wrap return into some HTML, like <div class=”status_text”></div> and style this block. add_shortcode( ‘linestatus’, ‘line_status_handler’ ); function line_status_handler( $atts ) { extract( shortcode_atts( array( ‘open_time’ => ’09:00:00′, ‘closed_time’ => ’17:00:00′, ‘open_text’ => ‘our lines are open’, ‘closed_text’ => ‘our lines are closed’, ), $atts ) ); if ( time() >= strtotime( … Read more

Div-Wrap with Functions.php in Childtheme using Shortcode!

Shortcodes come in two flavors: [shortcodename param1 = value, …, param-n = value] and [shortcodename param-1 = value, …, param-n = value]some content[/shortcodename] In both cases, add_shortcode(‘shortcodename’, ‘functionname’) function is identical. The functionname() function’s parameters, determine which flavor will be used: functionname($atts) is for shortcode with no closing tag, and functionname($atts, $content) is for shortcode … Read more