shortcode

WooCommerce shortcode products list

我们两清 提交于 2019-12-24 20:14:41
问题 I have to make a Wordpress plugin which adds shortcode for WooCommerce. I want to get products from a specific product category and the maximum number of products to show. The shortcode parameters should be category ID and product limit. I think I should have to use WP_Query object. I need to get it look like this: Shortcode would be like this: [productslist_category="[category_ID]" limit="[product_limit]"] I used the code below from this answer (thanks to LoicTheAztec) : if( !function_exists

Wordpress shortcode display as text

本秂侑毒 提交于 2019-12-24 17:08:51
问题 I have problem with WP shortcodes. When I am trying to publish a short code it is displayed as text. Ii looks like this: enter image description here I did try: Shortcode rendering as text not as shortcode should and may others. This is my shortcode.php <?php /** * WordPress API for creating bbcode like tags or what WordPress calls * "shortcodes." The tag and attribute parsing or regular expression code is * based on the Textpattern tag parser. * * A few examples are below: * * [shortcode /]

Detecting parameter names in php function for wordpress shortcode?

廉价感情. 提交于 2019-12-24 12:01:32
问题 I am trying yo understand this function, as a preface to forking it to make similar functions for my own shortcodes. I understand how to define shortcodes and their functions. I also basically "get" what the original author is doing here: collecting parameters from the shortcode and assembling them into an HTML tag and returning that tag. It seems the order of the params is unimportant, but their names are. However, when I am working with this code, it does not seem to understand which param

Formatting HTML

怎甘沉沦 提交于 2019-12-24 09:58:55
问题 I have been trying to get my tabs working by using the tabs shortcodes in PHP. The first part of my question was to figure out how to write the PHP code and shortcodes in the PHP file. @jeremyharris helped me out with this here ob_start(); get_template_part("includes/categories-panel"); $cats = ob_get_clean(); ob_start(); get_template_part('includes/home-map-panel'); $home = ob_get_clean(); echo do_shortcode('[tabs style="boxed"] [tab title="First Tab"]' .$cats. '[/tab] [tab title="Second Tab

How to put php code inside opening and closing shortcodes

假装没事ソ 提交于 2019-12-23 05:21:14
问题 I am working on a site and I am using a shortcode in my template files that has an opening and close. I would like to know if its possible to place wordpress the_content php tag in between the shortcode and if it's possible to the same thing with placing another shortcode in between opening and closing tags. I've tried this - <?php echo do_shortcode('[membership level="1"]''.$the_content.''[/membership]'); ?> But it's not working, I tried a few others things as well. What am I missing or

Wordpress get_option from shortcode

末鹿安然 提交于 2019-12-23 04:36:08
问题 I want to be able to get some wordpress options with the shortcode from the post, something like this: [get_option posts_per_page] Is there an easy way to do that? 回答1: I think it is pretty easy first, create a function that will handle the short code function handle_shortcode($para){ //get_options } secord, register the shortcode add_shortcode('getOption', 'handle_shortcode'); then, use it in a post: [getOption para="key"] more details look at here: http://codex.wordpress.org/Shortcode_API

How to Insert PHP between shortcodes for Tabs [tab]

无人久伴 提交于 2019-12-23 04:35:33
问题 I am looking to get some help in how to insert my php between my 2 tabs. I am using wordpress and trying to modify a template so that I can have 2 tabs on my page with dynamic content from two other php pages. I get 2 tabs but the content does not appear in the tabs, but instead above them. I misut be doing something wrong with the code below, but I have no idea what! My code is as follows: <?php echo do_shortcode('[tabs style="boxed"] [tab title="First Tab"]' .get_template_part("includes

How to Insert PHP between shortcodes for Tabs [tab]

廉价感情. 提交于 2019-12-23 04:34:12
问题 I am looking to get some help in how to insert my php between my 2 tabs. I am using wordpress and trying to modify a template so that I can have 2 tabs on my page with dynamic content from two other php pages. I get 2 tabs but the content does not appear in the tabs, but instead above them. I misut be doing something wrong with the code below, but I have no idea what! My code is as follows: <?php echo do_shortcode('[tabs style="boxed"] [tab title="First Tab"]' .get_template_part("includes

Get orders from a SQL query displayed on as a list in Woocommerce

给你一囗甜甜゛ 提交于 2019-12-23 04:06:07
问题 In woocommerce, I'm trying to create a shortcode to put in my function.php document, that displays a custom database query on a page. There's something wrong with it though and i'm not sure what. function sqlquery_shortcode($atts) { global $wpdb; $results = $wpdb->get_results(" SELECT a.order_id, a.order_item_id, a.order_item_name, b.meta_key, b.meta_value FROM 7pW9iX3L_woocommerce_order_items a JOIN 7pW9iX3L_woocommerce_order_itemmeta b ON a.order_item_id = b.order_item_id JOIN 7pW9iX3L

Display a WooCommerce coupon input field anywhere with a shortcode

怎甘沉沦 提交于 2019-12-22 23:26:11
问题 I have a small project on what I need to insert Woocommerce coupon field into any page, but this seems complicated for me. I searched on Google about this, but don't have any resources about this. Found this codes about inserting field. Inserted into a text block this code: <div class="redeem-coupon"> <form id="ajax-coupon-redeem"> <p> <input type="text" name="coupon" id="coupon"/> <input type="submit" name="redeem-coupon" value="Redeem Offer" /> </p> <p class="result"></p> </form><!-- #ajax