How to add multiple buttons to TinyMCE?

First add your additional buttons inside the buttons callback.. function register_button($buttons) { array_push($buttons, “quote”,”wpse-rules”); return $buttons; } Then add additional buttons function inside the plugin javascript.. init : function(ed, url) { ed.addButton(‘quote’, { title : ‘Add a Quote’, image : url+’/image.png’, onclick : function() { ed.selection.setContent(‘[quote]’ + ed.selection.getContent() + ‘[/quote]’); } }); ed.addButton(‘wpse-rules’, { title … Read more

WordPress removing tags?

This is pretty much what Foxsk8 mentioned in a comment, so credit should go to him, but these additional instructions will be useful. The WordPress plugin called TinyMCE Advanced will solve your problem. This plugin comes with an option inside Settings > TinyMCE Advanced that will fix your disappearing <p> tags. Mark the checkbox labeled … Read more

How to get URL param to shortcode?

If I understand your question correctly, you want to be able to get the parameter from the url, add it to the shortcode so you can add the parameter to the content. See if this works: add_shortcode(‘name’, ‘get_name’); function get_name() { return $_GET[‘name’]; } In the wordpress backend editor you would have something like: Hello … Read more

Why are you using add_action for shortcode?

If you take a look at the Codex page about add_shortcode() you won’t see anything about the need of an add_action() before you can use add_shortcode(). So, you can just put your add_shortcode() directly into your functions.php. This is what I do too. See this article – WordPress Shortcodes: A Complete Guide about the use … Read more

Create a shortcode to display custom post types with a specific taxonomy

First off, it’s always good to register shortcode during init versus just in your general functions.php file. At the very least add_shortcode() should be in init. Anyway, let’s begin! Whenever you use add_shortcode() the first parameter is going to be the name of the shortcode and the 2nd will be the callback function. This means … Read more

Get current post id witout passing in shortcode

add_shortcode( ‘related-article’, ‘related_article_title’ ); function related_article_title( $atts ) { global $post; echo $post->ID; // currently viewing post id ob_start(); $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 1, ‘order’ => ‘DESC’, ) ); if ( $query->have_posts() ) { ?> <div class=”menu-row”> <?php while ( $query->have_posts() ) : $query->the_post(); ?> Leggi anche: <a href=”https://wordpress.stackexchange.com/questions/210518/<?php … Read more

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