Localization inside shortcode not working
esc_html_e() displays (echo) the output, hence it appears at the wrong place. So you should instead use esc_html__() which returns the translated string.
esc_html_e() displays (echo) the output, hence it appears at the wrong place. So you should instead use esc_html__() which returns the translated string.
how to make this shortcode [parent-child] working with link=false , and no extract in shortcode. You can never pass boolean value as shortcode parameter, rather it should be treated as string. Your comparison over the param link value false should be used as ‘false’ (string). add_shortcode( ‘parent-child’, ‘taxonomy_hierarchy’ ); function taxonomy_hierarchy( $atts ){ // Don’t … Read more
You can do it like so: function filterDocumentTitle(string $title): string { // don’t change title on admin pages or when global $post is not loaded if (is_admin() || get_the_ID() === false) { return $title; } // don’t change title if shortcode is not present in content if (!has_shortcode(get_the_content(), ‘caption’)) { return $title; } return ‘special … Read more
Ultimately, I solved the problem by exporting the wp_posts table from the database and doing a regex search along the lines of ‘([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]’, ‘[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9])’, ‘(.*?)\[soundcloud url=\\”http://api\.soundcloud\.com/tracks/(.*?)\\” params=\\”auto_play=false&show_artwork=false&color=ff7700&show_playcount=false\\” width=\\”100%\\” height=\\”180\\” iframe=\\”true\\” /] and replacing it with ‘\1’, ‘<!– wp:paragraph –>\2<!– /wp:paragraph –><!– wp:embed \{“url”:”http://api.soundcloud\.com/tracks/\3″,”type”:”rich”,”providerNameSlug”:”soundcloud”,”responsive”:true\} –> <figure class=”wp-block-embed is-type-rich is-provider-soundcloud wp-block-embed-soundcloud”><div class=”wp-block-embed__wrapper”> http://api\.soundcloud\.com/tracks/\3 </div></figure> <!– … Read more
Change st_paragraph() to this: function st_paragraph( $atts, $content = null ) { return ‘<p class=”first-paragraph”>’.do_shortcode($content).'</p>’; } See Codex documentation.
Besides the plugin not being updated, this will not work because the meta_query arg is evaluated as a string: array(3) { [“post_type”] => string(7) “project” [“meta_query”] => string(96) “array(array(‘key’ => ‘state’, ‘value’ => ‘Completed’),array(‘key’ => ‘year’,’value’ => ‘2006’))” [“suppress_filters”] => string(5) “false” } I suggest you make a custom page template, where you would directly … Read more
Fixed my problem! I was finally able to find some info out there in the vast internet. Visit this site for info on fixing this odd issue. Over all using the remove_filter(‘the_content’,’wpautop’); did the trick. http://www.undermyhat.org/blog/2009/07/sudden-empty-blank-page-for-large-posts-with-wordpress/
Is the homepage pulling in the_excerpt() ? If so you will have to add this to your functions.php add_filter(‘the_excerpt’, ‘do_shortcode’); This will work if you are putting in manual excerpt. It shouldn’t be stripping out the shortcode if you are using the_content() in your homepage template.
Use a class, store the value you need in the footer in a member variable. Sample code, not tested: add_shortcode( ‘tooltip’, array ( ‘WPSE_69605_Tooltip’, ‘shortcode_callback’ ) ); class WPSE_69605_Tooltip { protected static $var=””; public static function shortcode_callback( $atts, $content=”” ) { self::$var=”foo”; add_action( ‘wp_footer’, array ( __CLASS__, ‘footer’ ) ); } public static function footer() … Read more
You can reuse the $content parameter: function image_code($atts, $content = null) { $url = esc_url( $content ); return “<a href=”https://wordpress.stackexchange.com/questions/78252/$url”><img src=”https://wordpress.stackexchange.com/questions/78252/$url” class=”user-imgs” /></a>”; } Or pass the URL as parameter in case you want to use a different URL: function image_code($atts, $content = null) { $args = shortcode_atts( array( ‘url’ => FALSE ), $atts ); … Read more