Do shortcode in WordPress term description work - wordpress

i want to run Slider Revolution shortcode like this: [rev_slider alias="media-carousel-autoplay7"] in term description, but it is not working and it prints me shortcode in category page. How can I solve this problem?

Try to add this line in functions.php:
add_filter( 'term_description', 'do_shortcode' );

[rev_slider] is probably not a 'shortcode' in WordPress sense.
I encountered this on different plugin, Stream media player. They use the same syntax as shortcodes, but they are actually not.
Try using:
apply_filters( 'the_content',' [rev_slider alias="media-carousel-autoplay7"] ');
instead of do_shortcode, and see if it helps.

Related

Shortcode not working in custom wordpress theme

I installed a Plugin in a wordpress site which uses some shortcode (like metaslider). But when I insert the shortcode in the page it is not displayed the content of the shortcode but only the string [shortcode].
Have I to insert something in the function.php file of the theme I use? (it is a custom theme)
Thanks in advance
If only the string [shortcode] is shown instead of the actual plugin output, it seems that the output of your pages does not use the do_shortcode filter properly. Without exactly knowing what's happening, try the following:
function filter_content_example($content) {
$content = do_shortcode($content);
return $content;
}
add_filter('the_content', 'filter_content_example');
This is only a first guess. Without further investigation i could not solve that problem.

Wordpress shortcodes working in php but not in text editor

I seem to be having a problem outputting shortcodes from the wordpress text editor. The shortcodes work fine when echoing from php but it is only in the text editor they simply produce what is written.
I have added the following lines to my functions.php:
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');
But this has no effect. This is happening across multiple plugins. Does anyone know why this might be happening?
Thanks!
So I've solved this. I figured out that this was only happening on custom templates. I then queried that issue and found that you have to use the_content() function to extract the content within your custom template and have shortcodes work. This is because the_content() parses the content in a manner that will make your shortcodes work.

Wordpress plugin shortscodes in other plugins?

I'm developing a plugin that creates custom wordpress pages, however I ran into a problem when trying to get shortcodes from other plugins to integrate into my plugin, well more like I couldn't find any info on it.
For example if someone uses my custom page builder and adds a short code [gallery] that is associated with an enabled plugin, I want the shortcode to do it's thing.
Could anyone point me in the right direction for this?
Try wordpress
http://wordpress.org/plugins/synved-shortcodes/
while this plugin let's you integrate shortcodes on every wordpress page , I suppose that you issue is with wordpress functions.php file where you can have a look at , with this plugin installed !
You can check if a shortcode exist before printing it with the function shortcode_exists() (https://codex.wordpress.org/Function_Reference/shortcode_exists)
Example:
<?php
if ( shortcode_exists( 'gallery' ) ) {
// The [gallery] short code exists.
}
?>
Then, if it exist and you want to print that shortcode with PHP code you should use do_shortcode() function (https://developer.wordpress.org/reference/functions/do_shortcode/)
Example:
<?php echo do_shortcode('[gallery]); ?>
Always use in WordPress's in-built
the_content
hook to print your custom page content.
WordPress by default process all shortcodes before outputting any stuff from this hook.
More info can be found here: https://codex.wordpress.org/Function_Reference/the_content

Space Retention from TextArea in Options Framework Plugin for Wordpress

I am using the latest version of Options Framework (which is found here: http://wordpress.org/extend/plugins/options-framework/) on the latest build of Wordpress to build out some theme options/controls. In a text area, I am asking the user for something that is best output via multiple paragraphs. I want to retain the spacing they specify in this textarea.
I output their option in via shortcode and all spacing is lost. I also output it via an echo and all spacing is lost. So it seems the spacing loss is occurring between input and storage.
THanks for any help!
i just tested this locally... the plugin maintains line breaks in the option's textarea, so the problem must be w/ how you are displaying it.
wordpress doesn't save p tags in the database, normally so they won't get saved by Devin's plugin. the function wpautop() is attached to the_content filter and it (sometimes seemingly willy-nilly, but that's a different discussion) determines what should be wrapped in p tags.
what if you
echo wpautop(of_get_option('test'));
something i came up w/ for a similar issue w/ textareas in metaboxes is to create a filter and attach the normal content filters to that... a "duplicate" the_content if you will. i started out straight up using apply_filters('the_content' $my_value) but some plugins hook into that filter and it can get weird.
echo apply_filters('meta_content',of_get_option('test'));
then somewhere in your functions.php
//recreate the default filters on the_content
add_filter( 'meta_content', 'wptexturize' );
add_filter( 'meta_content', 'convert_smilies' );
add_filter( 'meta_content', 'convert_chars' );
add_filter( 'meta_content', 'wpautop' );
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment' );

How to enable tinyMCE rich text editor for post Comments in WordPress?

I would love to kinda replicate WordPress post/page text editor (Admin panel) in comments section. That's how site users will be able to format text easily. A good example of what I actually need can be found here at StackOverflow when someone is about to Ask Question.
In your functions.php, add the following snippet:
add_filter( 'comment_form_defaults', 'tinymce_comment_4265340' );
function tinymce_comment_4265340 ( $args ) {
ob_start();
wp_editor( '', 'comment', array('tinymce') );
$args['comment_field'] = ob_get_clean();
return $args;
}
It's working on WordPress 3.5 and Twenty Twelve theme.
The TinyMCEComment WordPress plugin could help you out. It uses the internal TinyMCE editor (bundled in WordPress 2.0 and up).
Try this tutorial. It worked for me. The above answer might add TinyMCE to the reply section. The tutorial shows how to fix that.

Resources