WordPress shortcode display as plain text

First of all as far as I know that you can’t call get_template_part() from your plugin.It’s a Theme only function . Try to keep your calculator code’s in a php file inside your plugin’s directory and include it like bellow: function info_box_calculator_core(){ include( plugin_dir_path( __FILE__ ) . ‘mydir/calculator.php’); //replace ‘mydir/calculator.php’ with your file name } … Read more

Shortcode parsed incorrectly because of heredoc

A workaround might be: [code] $foo = &lt;&lt;&lt;EOT …. EOT; [/code] where we change <<< to &lt;&lt;&lt;. We could do this automatically before do_shortcode filters the content and then replace it again afterwards. I tested this version: [code] $foo = <<<EOT …. EOT;<!—-> [/code] and it seems to parse the shortocde’s content correctly. But then … Read more

How to Get a part of URL and put in shortcode?

This should work: function get_name() { $url = “http://domain.com/author/peter”; if (preg_match(“/author/”, $url )) { $lastSlash = strrpos( $url, “https://wordpress.stackexchange.com/”); return substr( $url, $lastSlash, strlen($url)); } } This will return everything after the last slash.

Shortcode not working on static front page

It looks like you need to change your front-page.php page, you are using the wrong variable. $static_page_content = get_the_content(); to $static_page_content = the_content(); Edit: I see you just updated your question to this, yes this will work fine. Shouldn’t see any negative side effects from this.

Execute shortcode only once in the page

Set a flag like $already_run to static and give it an initial value false. Then check if that value is true. If not, do the one-time thing and then set $already_run to true. The next time this function is called, it will not re-assign the static property, but will instead use the value set at … Read more

shortcode javascript not working on custom template file inside theme folder

You haven’t included get_header() or get_footer() in your template. They will load header.php and footer.php which should include wp_head() and wp_footer(). Those last two functions are important because that’s where scripts are loaded. If your shortcode depends on a script being loaded in the header or the footer, then you need wp_head() or wp_footer(), thats … Read more

Remove wpautop from specific shortcodes only

Well, there is a script out there. The author claims that it removes the wpautop form individual specific shorcodes. You’ll find it here. Add this to your functions.php or your plugin like below- // Here I assumed that you kept the name of the PHP script file same include “shortcode-wpautop-control.php”; And then call the function … Read more

Add custom setting that uses radio button to WP Gallery

I had the same problem and got it finally to work. Based on the thread you have followed, you now have to extend the “update” function of the WP core /wp-includes/js/media-views.js. Go to the “jQuery(document).ready(function()…” part of the ‘print_media_templates’ action and try this: <script> jQuery(document).ready(function() { wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend({ // add your custom options template … Read more

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