function list_display($atts) { $atts = shortcode_atts( array( 'pagename' => 'No Page Received' ), $atts ); extract($atts); echo $pagename; } add_shortcode('list-display', 'list_display'); You'll probably want to use "return" instead of "echo" if you're using the shortcode within pages and posts.. Echo could cause it to send output to the screen a...
You need to return the html in your callback function, e.g.: function test() { $html = ''; $html .= '<h1>Datos de Usiario</h1>'; $html .= '<form id="" action="" method="">'; // etc. return $html; } ...
php,jquery,wordpress,jquery-ui,shortcode
OK this is what you have to do. if( is_array( $GLOBALS['tabs'] ) ){ foreach( $GLOBALS['tabs'] as $k=>$tab ){ $tabs[] = '<li><a href="#tab-'.$k.'">'.$tab['title'].'</a></li>'; $panes[] = '<div id="tab-'.$k.'"><p>'.$tab['content'].'</p></div>'; } $return = "\n".'<!-- the tabs --><div class="tabs"><ul>'.implode( "\n", $tabs ).'</ul>'."\n".'<!-- tab "panes" -->'.implode( "\n", $panes ).'</div>'."\n"; } ...
This should do it. Just add the static value between the brackets. $str = 'The [adjective value="quick"] brown fox [verb value="jumps"] over the lazy dog.'; echo preg_replace("/\[adjective.*?\]/", '', $str); Output: The brown fox [verb value="jumps"] over the lazy dog. Demo: http://sandbox.onlinephpfunctions.com/code/3495d424001f71d360270cb78d767ba7d0ec034b This solution also presumes the first ] is closing...
php,wordpress,parameter-passing,shortcode
please modify your shortcode : [/box] to [end-box] [box color="bluemed"] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec nec nulla vitae lacus. [end-box] Try this : I replace [/box] to [end-box] and also in grey to 'grey' function colored_box_shortcode($atts) { extract(shortcode_atts(array( 'color' => 'grey', ), $atts)); return '<div class="shadow-wrapper...
wordpress,wordpress-plugin,shortcode
There's not enough information in your code sample to say for sure. However, it looks like you are attempting to put PHP code into an actual WordPress page/post. Is that the case? If not, please provide more info on what you're trying to do exactly. If so, you can't put...
wordpress,function,variables,shortcode
From what I'm understanding you're not trying to generate output with the shortcode, but to save data instead. I would try using custom fields to handle this. If you need to output the "USER DETAILS" block within the post content (right where the shortcode is written), you should just merge...
php,regex,quotes,shortcode,preg-split
Using preg_split is not always handy or appropriate in particular when you have to deal with escaped quotes. So, a better approach consists to use preg_match_all, example: $pattern = <<<'EOD' ~ (\w+) \s*= (?| \s* "([^"\\]*(?:\\.[^"\\]*)*)" | \s* '([^'\\]*(?:\\.[^'\\]*)*)' # | uncomment if you want to handle unquoted attributes #...
In the css of your template there is already a general styling rule for the color of h3. You should rather specify your selector a bit more in order to overrride this: .su-service-content:hover h3, .su-service-title:hover { background-color: #2680BE; color: white; } ...
function add_shortcode( $tag, $func ) is the core of what you need to know. So insert into your functions.php: function srpmgt_shortcode() { return ' Content to replace... '; } add_shortcode('SRPMGT_id=12345', 'srpmgt_shortcode'); ...
Are you doing this in the visual or the text editor? For Shortcodes to work must be on the text editor in the tinymce on the right tabs. Also you must include your myproduct_func in functions.php so it's available....
php,arrays,wordpress,shortcode
You didn't assigned the variable! See: $atts['size'] == false; //^^ See here, you don't assign anything You have to remove one = so it looks like this: $atts['size'] = false; Also i would use var_dump here, because if you assign false and you use print_r the output would be: Array...
php,wordpress,codeigniter,shortcode
I had to solve this using a completely different solution than any of the ones I mentioned above. The code below still needs to be tweaked, but you can get the idea. I had to add this function to my WP plugin: function save_shortcodes_to_db($content) { global $post; $postID = $post->ID;...
php,wordpress,plugins,echo,shortcode
You're not far off. You need to use get_field() rather than the_field(): the_field() actually echoes out the content, so that's why it's not working as currently using it. It's the equivalent of trying to echo it twice. Another thing to look out for is that you need to include the...
php,wordpress,wordpress-plugin,shortcode
Try this way: function testf($atts, $content = "") { // print_r($atts); die(); if (!isset($atts['username']) ) $atts['username'] = 'att'; if ( empty($content) ) $content = 'Follow me on Twitter'; // shortcode_atts ob_start(); ?> <div style="font-family: Arial, sans-serf"> <h2 style="color:orange">My Plugin here!</h2> <a style="color:blue" href="http://twitter.com/<?php echo $atts['username']; ?>"><?php echo $content; ?></a></div> </div>...
jquery,html,wordpress,shortcode
This should point you in the right direction to add a custom shortcode in your theme functions.php file: add_shortcode( 'rlcf_sermons', function( $atts ){ // set default attributes extract( shortcode_atts( array( 'speaker' => '', 'count' => -1 ), $atts ) ); // query $sermons = new WP_Query(array( 'post_type' => 'th_sermons', 'tax_query'...
$wpdb isn't defined in your shortcode callback so you'll be triggering an error when you try to access the get_results method. Add global $wpdb; to the top of your function....
1] Try using a switch on the $style variable to echo out the corresponding $return_string depending on it's value. 2] Pay special attention to the default: case, as it is what will be displayed if $style is not set to clear or white. I set it to have no attribute,...
Shortcode comes in fusion core plugin. fusion-core/shortcodes.php findout add_shortcode('youtube', 'shortcode_youtube'); remove frameborder from div under above shortcode....
php,wordpress,widget,shortcode
this is a tentative answer, if needed can be updated with more information: use this: // Display text if($instance['text']!="") { echo "\n<p class=\"lead\">" . str_replace("\n", "</p><p class=\"lead\">", do_shortcode($instance['text'])) . "</p>\n"; } or even this to apply all widget_text filters: // Display text if($instance['text']!="") { echo "\n<p class=\"lead\">" . str_replace("\n", "</p><p...
php,wordpress,return,echo,shortcode
You're using HTML where PHP is expected. That's why you have a blank screen. Here's how I'd move this into a shortcode: function wpse_shortcode_userlevel() { global $current_user; get_currentuserinfo(); $output = '<span class="shortcode-user-level">'; $output .= $current_user->display_name . "\n"; $output .= "Level: {$current_user->level} \n <br>"; $output .= '</span>'; return $output; } add_shortcode(...
I think you could use the_post action hook, that allows to modify the post object immediately after being queried and setup: add_action('the_post', function($post, $query){ // do whatever you want to $post, for example: $post->post_content = str_replace('{YOUR_SHORTCODE}', 'WHATEVER', $post->post_content); }, 10, 2); ...
php,forms,email,conditional-statements,shortcode
You need to set the $mailbox value before you try to use it. I recommend using jQuery. <script src="jquery.js"></script> <script type="text/javascript"> jQuery.noConflict(); (function ($) { function readyFn() { $("#emailSelect").change(function(){ $("#your_form").attr('action', 'MAILTO:' + $("#emailSelect").val() + '@email.com'); }); } $(document).ready(readyFn); })(jQuery); /*$(document).ready(function(){ $("#emailSelect").change(function(){ $("#your_form").attr('action', 'MAILTO:' + $("#emailSelect").val() +...
Yes, of course this is possible. You are using a WordPress loop, so just use get_the_excerpt(). while (have_posts()) : the_post(); $return_string .= '<li><a href="'.get_permalink().'">'.get_the_title().'</a>'; $return_string .= '<div class="excerpt">' . get_the_excerpt() . '</div></li>'; endwhile; You can use the new_excerpt_more filter to control what displays at the end of the excerpt. Here...
wordpress,plugins,woocommerce,shortcode
My Account shortcode: [woocommerce_my_account order_count="-1"] Shows the ‘my account’ section where the customer can view past orders and update their information. You can specify the number or order to show, it’s set by default to 15 (use -1 to display all orders.) Reference: Woocommerce Shortcodes Update If you need only...
wordpress,wordpress-plugin,shortcode
Try changing get_post_field('post_content', $post->ID) to echo do_shortcode(get_post_field('post_content', $post->ID)); It should work....
php,jquery,wordpress,global,shortcode
You have to echo variables for them to output columnWidth: <?php echo $masonry_item_width ?>, gutter: <?php echo $masonry_item_padding ?>, As to how to get your values... Wordpress makes plugins such a mess with all these standalone callbacks. Normally I would abhor doing this but I can't think of any other...
It's because of the negative lookahead assertion at the end. I suggest you to remove that lookahead and use a greedy regex pattern like below. \[dzspgb_container(.*?)](.*)\[\/dzspgb_container\] DEMO (?!\s*\[\/) asserts that the match won't be followed by (zero or more space characters and a [ symbol)...
html,wordpress,shortcode,static-html
This problem occurs whenever a plugin is printing out its contents instead of using return. See the Shortcode API docs for more information; http://codex.wordpress.org/Shortcode_API#Output...
You need to rename your template file to portfolio-shortcode.php (with a dash rather than an underscore). get_template_part is checking for the following file: {current_theme}/includes/shortcode_helpers/portfolio-shortcode.php You also need to change the first parameter of get_template_part to remove the leading slash: get_template_part('includes/shortcode_helpers/portfolio', 'shortcode'); See get_template_part on the WordPress Codex for the order...
I don't know much about wordpress, nor the reason why it looks like this, but nesting quotes three times can get very confusing and should be avoided if possible. The PHP in your example is invalid in several ways: Quotes are not properly escaped Some of the HTML within your...
It seems like the shortcode sp_responsiveslider isn't actually defined. Are you sure the plugin is installed correctly? If the plugin is installed correctly you can test to see if shortcodes are working on your WordPress installation. Paste the following in your functions.php file (add <?php to the first line if...
LIVE: It was very hard to achieve: (Hope it helps) // auto_descritive function wrap_string( str, open_param, close_param ){ var text = $(".content").text(); // all indexes of str var re = new RegExp(str,'gi'), results = []; while (re.exec(text)){ results.push(re.lastIndex); } // check each parent param of each str for (var i=0;...
You will need to alter how the RSS is output. All the RSS styling files are located in the wp-includes folder and are titled as follows: feed-rss2.php feed-rss.php feed-rdf.php feed-atom.php feed-atom-comments.php feed-rss2-comments.php Then within these files, you need to find where it calls the function the_excerpt_rss(). This calls out the...
php,wordpress,nested,shortcode
try this in your display_activity method if it works for you .. $theContent = str_replace('[textarea]','[textarea id="'.$activityId.'"]', $theContent); $html .= "<div class='sbusuws-activity-content'>"; $html .= do_shortcode($theContent); $html .= "</div>"; ...
You can do it either like this (short way): $list .= '<div class="collapse-card"> <div class="title">'; if($accordion_icon) $list .= '<i class="fa '.$accordion_icon.' fa-2x fa-fw"></i>">'; else $list .= '<i class="fa fa-question-circle fa-2x fa-fw"></i>'; Or like this (long way): $list .= '<div class="collapse-card"> <div class="title">'; if($accordion_icon){ $list .= '<i class="fa '.$accordion_icon.' fa-2x fa-fw"></i>">';...
php,wordpress,plugins,tags,shortcode
You don't really need a shortcode unless the position changes per post. To render tags in your template (you could just move the code): <?php the_tags(); ?> If you wanted to make a shortcode: function sc_taglist(){ return get_the_tag_list(); } add_shortcode('tags', 'sc_taglist'); And use [tags]...
According to the Codex for add_shortcode the attribute names for a shortcode are converted to lowercase. Shortcode attribute names are always converted to lowercase before they are passed into the handler function. Values are untouched. That would mean you need to access your array keys with the lowercase version for...
php,wordpress,function,woocommerce,shortcode
You can check the current user's paying_customer user meta field with following function: function so27296867_is_paying_customer() { $user_id = get_current_user_id(); if( '' != get_user_meta( $user_id, 'paying_customer', true ) ) return true; return false; } and use the function in a conditional check: if( so27296867_is_paying_customer() ){ // current user is paying customer,...
If you're adding markup to your posts, you should NOT be using the visual editor. Either find a way to add your markup via a custom filter, so you can avoid inserting into your posts, or STOP USING THE VISUAL EDITOR. The visual editor is for people who don't know...
php,jquery,wordpress,shortcode
You could manually call do_shortcode on the string your shortcode callback returns. Something like the following should work: // Add Shortcode function person_shortcode( $atts , $content = null ) { // Attributes extract( shortcode_atts( array( 'name' => 'name', 'numb' => 'numb', ), $atts ) ); // Code return do_shortcode( '<p...
This regex matches the sample text you provided: /="(.*?)"(?=\s*(?:[a-z]+=|]))/ Explanation: =" '="' ( group and capture to \1: .*? any character except \n (0 or more times (matching the least amount possible)) ) end of \1 " '"' (?= look ahead to see if there is: \s* whitespace (\n, \r,...
wordpress,plugins,frontend,shortcode
I have got it working with the help of short code. Here is what i did. added this code in my main plugin file i.e: amt.php add_shortcode( 'clan', 'clan_fn' ); function clan_fn() { } Create a new page from word press admin and simply call the short code as below...
android,android-studio,shortcode,tabular
Sure. Press (and keep pressed) the alt-option command on your Mac, then click with the mouse/touchpad and move upwards/downwards. The effect is the following: (source)...
php,wordpress,plugins,shortcode
An easy workaround is to use Output control functions: function shortcode_fn( $attributes ) { ob_start(); // start a buffer wanted(); // everything is echoed into a buffer $wanted = ob_get_clean(); // get the buffer contents and clean it return $wanted; } ...
php,wordpress,attributes,shortcode,is-empty
If you want it to display if something is "empty", you're using the wrong method with if(!empty($ptitle)){ you're telling it if it is NOT empty. The ! is a negation character which translates as not. You need to use if(empty) Plus, you also need to echo while inside PHP. Another...
php,wordpress,wordpress-loop,shortcode
Based on your comment, maybe this helps: function testimonial_thumb_shortcode($atts){ extract(shortcode_atts(array( 'category' => '' ), $atts)); $q = new WP_Query(array( 'posts_per_page' => -1, 'post_type' => 'testimonials', 'testimonial_cat' => $category )); $list = ' <ul><li>'; $i = 0; //init the counter while($q->have_posts()): $q->the_post(); $idd = get_the_ID(); $author_photo = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); $list .=...
As I've mentioned in my question's Update this bit of code in the functions.php does the trick: remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 99); add_filter( 'the_content', 'shortcode_unautop',100 ); As seen in this question's answer: http://stackoverflow.com/a/21460343/1275525 and this post: http://www.paulund.co.uk/remove-line-breaks-in-shortcodes (scroll down to: Removing wpautop() To Content Only In...
attributes,woocommerce,product,shortcode
You could either unregister and re-register your own version of the shortcode OR the [product] shortcode displays content via <?php wc_get_template_part( 'content', 'product' ); ?> Therefore you can customize the the content-product.php template in your own theme via template overrides or via hooks/filters. (The content-product.php template is mostly just a...
wordpress,audio,html5-audio,shortcode
The problem is not the url, it works fine with the extra paramaters. I think the problem is that the visibility of the element is on hidden: style="width: 100%; visibility: hidden;" Another problem can be that it says audio/mpeg instead of audio/mp3....
php,wordpress,woocommerce,custom-fields,shortcode
Remember, shortcodes are just a convenient wrapper for using other existing functions. If you look inside of class-wc-shortcodes.php you'll find that the [product_category] shortcode includes the content-product.php template to output the products. You can override any template in WooCommerce by copying it to your theme folder: create a new folder...
So effectively you want to pass the supplied terms="SOMETHING" to the function defined in add_shortcode ? The example from this page ( http://codex.wordpress.org/Shortcode_API ) is // [bartag foo="foo-value"] function bartag_func( $atts ) { $a = shortcode_atts( array( 'foo' => 'something', 'bar' => 'something else', ), $atts ); return "foo =...
You need to have the whole shortcode block inside the do_shortcode function. So you could do something like this: $text = some_code_or_function_that_returns_text_your_shortcode_can_act_on(); $sc_string = sprintf("[myshortcode]\n%s\n[/myshortcode]", $text); echo do_shortcode($sc_string); ...
Just add a negative lookahead assertion like below, \[cigar].*?\[\/cigar\](?!\s*\[\/) DEMO (?!\s*\[\/) Negative lookahead asserts that the match would be followed by any but not of one or more spaces and further followed by [/ symbols....