Theme Convert PHP code to shortcode

This should do it, I used output buffering with ob_start() and ob_get_clean: <?php /** * Breadcrumbs based on theme’s functions * * @author Nabil Kadimi <[email protected]> * @link http://wordpress.stackexchange.com/a/242547/17187 */ add_action( ‘init’, function() { add_shortcode( ‘mycrumbs’, function() { /** * Start capturing output. */ ob_start(); ?> <div class=”x-breadcrumb-wrap”> <div class=”x-container max width”> <?php x_breadcrumbs(); ?> … Read more

Anchor text in Short code →

I think you just need to add link_url to the shortcode, like so? [tm_single_image animation=”fadeInLeft” classname=”sub-banner1″ image=”http://trafficspinners.com/wp-content/uploads/2016/11/wedding-seating-chart-downloadable2.jpg” link_url=”YOUR-LINK-HERE”] Unless I am not understanding what you mean by ‘clickable anchor text’.

add new attributes into existing shortcodes

All you need to do is modify the $a-variable, for example, to add a target to this link, you would add it to the array making up the $a-var, and printing it later. add_shortcode( ‘button’, ‘btn_shortcode’ ); function btn_shortcode($atts, $content = null) { $a = shortcode_atts(array( ‘class’ => ‘button’, ‘href’ => ‘#’, ‘target’ => ‘_blank’ … Read more

Add div on EMED Tag

you can use ’embed_oembed_html’ to wrap that iframe inside the div. add_filter(’embed_oembed_html’, ‘Oembed_youtube_no_title’, 99, 4); function Oembed_youtube_no_title($html, $url, $attr, $post_id) { return ‘<div class=”embed-container”>’ . $html . ‘</div>’; } Didn’t test please let me know if it works for you.

Get array of shortcodes within string

function wpse250308_get_questions() { global $post; if ( preg_match_all(‘/\[question(.*?)\]/’, $post->post_content, $questions ) ) { $questions = array_key_exists( 1 , $questions) ? $questions[1] : array(); // $questions will contain the array of the question shortcodes //Do your stuff } } $post isn’t available before wp. So, you have to hook on it or actions that fires later.

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