Shortcode for Visual Composer Grid fails turning string to integer
$term_list = wp_get_post_terms($post->ID, ‘product_features’, array(“fields” => “all”)); foreach($term_list as $term_single) { echo $term_single->slug; //do something here }
$term_list = wp_get_post_terms($post->ID, ‘product_features’, array(“fields” => “all”)); foreach($term_list as $term_single) { echo $term_single->slug; //do something here }
Don’t use double quotes (“) inside the shortcode, since you are using double quotes to specify the href attribute. The browser thinks your href text ends at position=. Use single quotes instead: href=”https://wordpress.stackexchange.com/reservation/?unitrate=[print_csv position=”5′]&… I agree with the comments that there is a better way to do this, but I provide a potential answer anyway … Read more
Probably you need to create a shortcode with parameters. You should have different parameters for font size, color, bold, underline or anything else. The user should insert a value for each of these parameters in the shortcode. You can find what you need here https://developer.wordpress.org/plugins/shortcodes/shortcodes-with-parameters/ It is a little tricky though because you must check … Read more
If you’re using PHP > 5.3, then you can use a closure on the the_content filter. This filter needs to be added after the $variable has been defined and before the the_content filter has fired. add_filter( ‘the_content’, function( $content ) use ( $variable ) { return str_replace( ‘[variable][/variable]’, $variable, $content ); } ); Shortcodes are … Read more
could be a question of string concatenation – try (untested): <a href=”‘.get_permalink().'” title=”‘.get_the_title().'”><img src=”‘. get_bloginfo(‘template_directory’).’/timthumb.php?src=”.$thumb.”&h=100&w=600&zc=1&q=100&a=”.get_post_meta($post->ID, “thumbcrop’, true).'” alt=”‘.get_the_title().'” /></a>
I had a similar problem, global $post; was returning NULL. But it works fine if I don’t use short codes. So I found a function for getting the post id from the URI, you might be able to extend it to get more information if you need it. Try this: var_dump(url_to_postid($_SERVER[‘REQUEST_URI’]));
you need to sert the ‘echo’ parameter of wp_list_pages() to 0 (zero): $return_string .= wp_list_pages(‘sort_column=menu_order&title_li=&echo=0’);
For anything related to adding code to wordpress.com you should contact automatic.
If the plugin has shortcodes, then you can use the function do_shortcode to display it within a theme file. It’d be a case of: <div class=”align-center”><?php do_shortcode( “[audio-player title=”Lorem Ipsum”]” ); ?></div>
wpautop has got to be my least favorite part of working with WordPress. Just when everything else is working, it sticks its fingers into everything… The problem has to do with filter priority, as you noted earlier. In the case of the excerpt, we’re interested in the filter get_the_excerpt. I haven’t been able to figure … Read more