How do write this type shortcode? [closed]
You can use below shortcode .. $att_url is document path <?php echo do_shortcode(‘[gview file=”‘.$att_url.'”]’); ?>
You can use below shortcode .. $att_url is document path <?php echo do_shortcode(‘[gview file=”‘.$att_url.'”]’); ?>
Here is an example of a shortcode that renders post content based on the id and type attribute. [post type=”content” id=”2″] [post type=”title” id=”2″] If you want to render from a template you would use: echo do_shortcode ( ‘[post type=”content” id=”294″]’ ); echo do_shortcode ( ‘[post type=”title” id=”294″]’ ); And here is the actual shortcode … Read more
You should add to theme something like this: add_filter(‘shortcode_function_name’, ‘do_shortcode’); This should be enough. Here you can find the documentation related to the shortcodes: https://developer.wordpress.org/reference/functions/do_shortcode/
Hi You can use this below code in your function.php add_action( ‘init’, ‘register_shortcodes’); function register_shortcodes(){ add_shortcode(‘go-to-top’, ‘gtp_function’); } function gtp_function($atts) { extract(shortcode_atts(array( ‘text’ => ‘<i class=”fa fa-arrow-circle-up fa-3″></i>’, ‘speed’=>500, ‘bottom’=>20, ‘right’=> 20 ), $atts)); ?> <script> $ = jQuery.noConflict(); (function($){ $.fn.addScrollToTopButton = function(options){ var $t = $(this); var settings = $.extend({ text : “<a href=”#” … Read more
You are not using proper syntax, so you are likely getting a syntax error. You are using some strange sign in your code where you should be using a single quote (‘). Also, use curly brackets to enclose a condition. It is easier to debug <?php if(function_exists(‘wooslider’)){ echo do_shortcode(‘[wooslider slider_type=”posts” limit=”3″ link_title=”true” layout=”text-bottom” overlay=”full” category=”homepage-feature-post”]’); … Read more
Your shortcode is not echoing the html in the right way. You have <span class=”icon”> <img …> </span> <span class=”text”> <span class=”title”> … </span> <span class=”description”> … </span> </span> In this way you cannot put icon and title inline. You need: <span class=”icon-title”> <img …> <span class=”title”> … </span> </span> <span class=”description”> … </span> This … Read more
As far as I know, ARVE is no longer necessary to use. As well, WordPress does not add p nor br tags ever. So if they are being added, you probably have a third party editor which adds them or maybe a custom function. Either way, you can probably disable that feature.
Your shortcode name and shotrcode_function_name are dynamic i.e vary with post name, which cause problem if you have same post title for two post. Also, you may not know or may be confused what shortcodes are available. I recommend to do this if your post title will always be unique. while ($query->have_posts()) { $query->the_post(); $shortcodename … Read more
I suggest to just append the other things to the content without editing the templates add_filter(‘the_content’,’hang_my_specific_things_on_the_content’); function hang_my_specific_things_on_the_content($content) { // shortcode0 is appended before content $content = do_shortcode(‘[shortcode0]’).$content; // these are appended after the content $content .= do_shortcode(‘[shortcode1]’); $content .= ‘<img src=”https://wordpress.stackexchange.com/questions/312880/someimage.png” />’; $content .= do_shortcode(‘[shortcode2]’); return $content; }
You will get this error if foreach() is not an array. So your first step should be to debug this by inspecting the contents of $results to confirm that the results are what you expect. If it’s not then it might give you clues to why. This is debugging 101. If you do that you’ll … Read more