My shortcode does not call the function

Please replace the old code with below code it will show you that it’s working add_shortcode( ‘bg_recent_post_grid’, ‘bg_recent_post_grid_shortcode’ ); function bg_recent_post_grid_shortcode( $atts ) { // Attributes $atts = shortcode_atts( array( ‘category_name’ => ‘uncategorized’, ‘number_posts’ => ‘1’, ), $atts ); return bg_make_post_grid ( $atts[‘number_posts’], $atts[‘category_name’] ); } function bg_make_post_grid ( $number_posts, $category_name ) { $args = … Read more

Creating a short code with php inside

I stripped out a lot of the code that wouldn’t be needed in a shortcode: function sx372821_request_quote_button( $atts = array() ) { global $product; $atts = shortcode_atts( array( ‘button_text’ => get_option( ‘wc_quote_button_text’ ), ), $atts, ‘request_quote_button’ ); $product_id = $product->get_id(); $wc_quote_button_text = esc_html( $atts[‘button_text’] ); if ( empty( $wc_quote_button_text ) ) { $wc_quote_button_text = esc_html__( … Read more

Placing tags on wordpress visual editor using shortcodes

Assuming you don’t have the shortcode written down… function search_shortcode() { $struct=”<div class=”searchbar” ><div class=”searchbar-inner” >search <input type=”text” id=”search” /><span class=”result-count” ></span></div></div>”; return $struct; } add_shortcode(‘search_box’, ‘search_shortcode’); Make sure your editor is in the ‘HTML’ mode, and paste the shortcode as ‘search_box’. Using a shortcode will allow you to reuse this form anywhere you want.

Buddypress shortcode for tabs [closed]

Use the following code, function custom_add_activity_tab() { ?> <li id=”custom-tab”> <a href=”https://wordpress.stackexchange.com/questions/60691/<?php echo site_url( BP_ACTIVITY_SLUG .”https://wordpress.stackexchange.com/” ) ?>” title=”<?php _e( ‘Tab.’, ‘buddypress’ ) ?>”> <?php printf( __( ‘tab’ , ‘buddypress’ ) ); ?> </a> </li> <?php } add_action( ‘bp_activity_type_tabs’, ‘custom_add_activity_tab’ ); Check it, Will work better

Shortcode Function not working

You are passing show_blog_posts two parameters… $str .= show_blog_posts($post->ID, ”); … but you have defined it to accept none… function show_blog_posts() { There seems to be some disconnect between your two blocks of code. I’d suggest actually passing the $post object the way that you are trying to. function show_blog_posts($post = NULL) { global $blog, … Read more

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