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
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
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
Shortcode for displaying the user’s first name?
do_action is a WordPress function for running action hooks. I assume that is what you are trying to do. Given that, The first parameter, the only one in your case, needs to be an action hook name. If you pass it a valid hook name and have a function attached to that hook, this code … Read more
You can use the pre_post_update filter hook to achieve this. Unfortunately the Codex isn’t very good for this hook, but it’s a simple enough one to understand and can be found in wp-includes/post.php on line 3335 (WP 4.1). add_filter( ‘pre_post_update’, ‘my_replace_shortcode’, 2, 99 ); function my_replace_shortcode( $post_id, $data ){ if(strpos($data[‘post_content’], ‘[myshorcode param1=”‘) !== false) : … Read more
You forgot the image tag as well… return ‘<a target=”_blank” href=”https://openforestry.org/validity-integrity”> <img style=”float: right; margin: 0px 10px 10px 10px;” src=”https://openforestry.org/wp-content/uploads/2017/08/data_integrity.png”> </a>’;