shortcode

WooCommerce custom shortcode product categories dropdown

天大地大妈咪最大 提交于 2021-02-10 06:27:06
问题 I am trying to add a WooCommerce categories-dropdown-shortcode, but this seems to not work. I am able to see the drop down, but when i choose a category it doesn't register and nothing happens. sc: [product_categories_dropdown orderby="title" count="0" hierarchical="0"] Code that's placed in my functions.php file <?php /** * WooCommerce Extra Feature * -------------------------- * * Register a shortcode that creates a product categories dropdown list * * Use: [product_categories_dropdown

Get the Order ID in Woocommerce order received page as shortcode

℡╲_俬逩灬. 提交于 2021-02-07 10:24:36
问题 I want to have WooCommerce Order ID's referenced as a shortcode to be easily be used in the Order received page to generate dynamic links. function my_order_id( $atts ) { echo $order->get_id(); } add_shortcode( 'my_order_id', 'my_order_id'); 回答1: Here is the way to get the Order ID in "Order received" (thankyou) page as a shortcode: function get_order_id_thankyou( $atts ) { // Only in thankyou "Order-received" page if( ! is_wc_endpoint_url( 'order-received' ) ) return; // Exit global $wp; //

How to add multiple buttons to TinyMCE in WP?

泄露秘密 提交于 2021-02-07 07:00:49
问题 I've followed a tutorial on Nettuts on how to add a custom button to TinyMCE (http://net.tutsplus.com/tutorials/wordpress/wordpress-shortcodes-the-right-way/) It works great and all, but i want to add many buttons and i wonder if there's a smart way to do this without having to duplicate all the code over and over. Here's the code i use for adding a button: add_shortcode("quote", "quote"); function quote( $atts, $content = null ) { return '<div class="right text">"'.$content.'"</div>'; } add

Wordpress shortcode is not called

醉酒当歌 提交于 2021-01-29 17:59:38
问题 Okay, I have created a plugin and now want to provide shortcode to app. Here is my only file in wp-content/plugins/my-plugin/my-plugin.php <?php /** * Plugin Name: Latest Issue * Author: Max Tsepkov * Author URI: http://www.yogi.pw */ add_action('init', function() { add_shortcode('my-plugin', function() { // ... my code return 'string'; }); }); I know that plugin is activated and the callback for init is called. But the shortcode function is never get called. I add text [my-plugin] to a

Wordpress improve shortcode with more parameters

余生颓废 提交于 2021-01-28 11:50:17
问题 when you are a new designer and start working with several content editors in wordpress, the first thing you realize is that it is not easy to find the functions you want exactly. plugin editors can't think of everything.. and especially extract information to display them everywhere in the desired and consistent manner. that's why wordpress shortcodes exist. but you have to master them.. first! (which is precisely my handicap currently) Grab your cup of coffee ☕ and admire the detailed

How can we display the edit account form using shortcode?

好久不见. 提交于 2021-01-28 06:10:28
问题 How can we display the edit account form using shortcode? I believe we should create a new function, and I think we will put this at the end of the function: add_shortcode ('display-edit-account-form', 'display_edit_account_form'); . //[display-edit-account-form] function display_edit_account_form() { return edit account form; } add_shortcode ('display-edit-account-form', 'display_edit_account_form'); This is my edit account form code from my form-edit-account.php: <?php /** * Edit account

Product shortcode - Removing product title on blog posts and pages

情到浓时终转凉″ 提交于 2021-01-28 01:10:11
问题 How do I remove the title on WooCommerce products when they are posted as short codes? [product_page id="99"] I am getting a double title: on the shortcode product embed on the actual blog post I would like to disable to title on the shortcode only and keep the title on the blog post, but keeping the title on the shop page. 回答1: Those titles are hooked in content_single-product.php WooCommerce template file as you can see below: /** * woocommerce_single_product_summary hook. * * @hooked

WooCommerce: Display some reviews randomly on home page

守給你的承諾、 提交于 2021-01-24 11:26:32
问题 I want to have 5 random reviews appear on my home page each time someone visits. I found some code to fetch all the reviews: //add get product reviews to homepage function get_woo_reviews() { $count = 0; $html_r = ""; $title=""; $args = array( 'post_type' => 'product' ); $comments_query = new WP_Comment_Query; $comments = $comments_query->query( $args ); foreach($comments as $comment) : $title = ''.get_the_title( $comment->comment_post_ID ).''; $html_r = $html_r. "" .$title.""; $html_r =

Radio buttons for custom post type categories from shortcode comma separated value

无人久伴 提交于 2021-01-07 03:01:08
问题 I have created a custom post type. Everything works fine with a shortcode like this [program] Now I would like to be able to create a shortcode like this [program category="category_1,category_2,category_3"] All those categories slugs from the shortcode have to appear in a radio button filter with the categorie name. Its working with only one category in the shortcode but once they're more and with commas it doesn't. <?php function program_shortcode( $atts ) { ob_start(); extract( shortcode

Radio buttons for custom post type categories from shortcode comma separated value

假如想象 提交于 2021-01-07 02:59:43
问题 I have created a custom post type. Everything works fine with a shortcode like this [program] Now I would like to be able to create a shortcode like this [program category="category_1,category_2,category_3"] All those categories slugs from the shortcode have to appear in a radio button filter with the categorie name. Its working with only one category in the shortcode but once they're more and with commas it doesn't. <?php function program_shortcode( $atts ) { ob_start(); extract( shortcode