Questions tagged [shortcode]

BB-Code-like mechanism by which strings enclosed in square brackets can serve as shorthand for longer and more complicated strings. These strings are processed by callback handlers, usually on page load, which replace the bracket enclosed string with the output from the callback handler.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

shortcode to display woocommerce cart total

I just hit a stumbling block. I'm currently using the <?php echo WC()->cart->get_cart_total(); ?> function to output the price of the products in cart. However, the resulting output was ...
0
votes
0answers
9 views

shortcode function is giving an error - uncaught Error: Call to a member function get_id()

Function of the shortcode, Get the current active product ID and create a url with that product id mydomain.com/templates/?pid='.$id. I'm looking to use this shortcode on an elementor button this ...
-3
votes
0answers
17 views

Convert php into shortcode [closed]

Kindly someone convert this php code into shortocode. I am unable to do this. Thanks in advance! <?php if ( $type == 'credit' ) { <p><?php _e( "Thank you for using your nedvil wallet.", ...
0
votes
0answers
14 views

How to use Wordpress Global Variable in shortcode (e.g. $page)

I have shortcode that requires a postID as input: e.g. [tribe_event_inline id='123 which I want to use in a template file, so that it updates for the current page: e.g. [tribe_event_inline id=$page. ...
0
votes
1answer
16 views

Display Custom Taxonomy Name As A Shortcode

On my WordPress site I have created a custom taxonomy named "game" which lists different gaming titles. I want to be able to display the names of these titles on my posts using a shortcode. Prior to ...
0
votes
0answers
16 views

Is there any way to set the Featured image in wordpress post editor, using a Getty images embed code

I want to be able to use a Getty images embed code to set the featured image (Post thumbnail) in my wordpress post editor. Is there any way of doing this? I understand that Wordpress doesn't allow ...
1
vote
1answer
17 views

What is the $atts parameter in shortcode_atts()?

The WordPress developers reference page for shortcode_atts() states: $atts (array) (Required) User defined attributes in shortcode tag. But I do not understand this definition. For example, in ...
0
votes
1answer
21 views

Show the parent taxonomy by creating shortcode in woocommerce?

How would I create a shortcode to show the parent taxonomy in woocommerce? My product categories should be like: - Food -- Fruits --- Healthy Fruits --- Organic Fruits -- Meat --- Pork --- ...
0
votes
1answer
19 views

Inject HTML meta tag inside wordpress <head> tag using add_shortcode

I am trying to add some meta-tag when shortcode [refresh url='http://stackoverflow.com'] tag is used. I have done below code, but it is not working, I want to inject HTML code between "<head>" ...
0
votes
0answers
17 views

Gutenberg Shortcode will turn html to html entity

I defined a shortcode [plot] to write dot code. For example, I insert code below by using Gutenberg Shortcode: [plot] digraph G { a->b; } [/plot] But when I re-edit the code, it will be converted ...
0
votes
1answer
8 views

How take a widget/shortcode on top of page content with CSS o JS?

I wrote a shortcode that generate a custom HTML element using HTMLElement JavaScript class. This widget uses a lot of custom CSS. It works good but on some themes (like The7 i.e.) some page content ...
0
votes
1answer
32 views

Shortcode for custom query not returning results when attributes are added

I'm trying to build a shortcode that will allow the user to choose what category is displayed and how many posts will show. The shortcode worked fine until I added the 'tax_query' add_shortcode( '...
0
votes
1answer
44 views

Need help in setting up a transient using API Key and if possible updating it in the ACF field

I am trying to set up a shortcode that will fetch Moz API data but I am facing issues. Sometimes, it returns values to 0, and sometimes it works. I don't know what I am doing wrong here. Might be I ...
0
votes
0answers
13 views

How to modify the WP posts layout?

I hope everyone is sound and safe on your side. I have a plugin (used to hide/show content by clicking on a button) inviting to place a shortcode before and after the content to hide. Here I am ...
0
votes
1answer
21 views

Shortcode not staying inside div tag

Using this php to show a signup form in my template file: <div style="border: 3px solid green; margin-top: 1em; height: auto"> <h2>Blog notifications</h2> <?php echo do_shortcode(...
0
votes
1answer
20 views

the_content() not showing the content in good order (with a shortcode)

I've added a shortcode [form] inside my wysiwyg the 2 paragraphes before the shortcode. <p>test 1</p> <p>test2</p> [form] but on the frontend, the shortcode is showing at ...
0
votes
1answer
10 views

Override wordpress audio playlist

To overwrite wordpress audio you would use wp_audio_shortcode_override filter and then return your own output. Is there a way to overwrite audio playlist? [playlist ids="1268,1265,1196"]
0
votes
1answer
45 views

Get Shortcode output to database for static post_content

my simple shortcode retrieves a list of articles as text files from a folder. These articles are in html format (with h2, p ...). I use a plugin which creates the pages I need on the fly in which I ...
0
votes
0answers
6 views

Insert tinymce Popup array Gallery

In function i add_filter to mce: function custom_mce_buttons() { if ( get_user_option( 'rich_editing' ) == 'true' ) { add_filter( 'mce_external_plugins', 'custom_tinymce_plugin' ); ...
0
votes
0answers
9 views

Find all shortcode occurances on posts

I need to build an array showing all occurrences in posts of a shortcode in the form of [image=xxx] where xxx is the ID of a media attachment. The site in question has multiple uses per post of this ...
-1
votes
0answers
12 views

How to get value given from user in shortcode?

I want to display posts by number value from user given in "pocet" parameter [oblubene-clanky pocet=""] function my_shortcode( $atts ) { ?> <div class="list_posts mt-5"> <?php ...
0
votes
0answers
8 views

Problems when adding button to TinyMCE in wordpress

I need help with the following: When I follow the steps outlined in this answer the button appears in TinyMCE. However, I need to change what it outputs, and no matter what I change it always outputs ...
0
votes
1answer
17 views

How to change shortcode's default theme?

I'm very new to web development. I'm currently using Divi to build my page and I'm using predefined shortcodes like [submit_job_form] of WP Job Manager plugin. When I add this to my page, the ...
0
votes
0answers
15 views

Override custom visual composer shortcodes via child theme

I'm using a custom theme recently bought via themeforest. Unfortunately the dev is not supporting the theme anymore. What i'm trying to achieve is to override branded (created by developer) visual ...
0
votes
0answers
4 views

How do I pull out an embed out of a post's content?

I wanna pull out an embed (its output) from a post. Here's what I've tried so far: Go through the post. Find any links by any regex. Look in an array to see if that link's baseline youtube is ...
1
vote
0answers
16 views

Orderby is working with one query but not with other

I'm using a shortcode to show some price boxes. I use a CPT with a custom field called 'posicion' which has a number that I use later to customize the loop. This is the code: <?php if ( ! defined( ...
0
votes
1answer
13 views

How come a YouTube link isn't transformed into a shortcode inside the post content?

Assume I wanted to add the following video link https://www.youtube.com/watch?v=YceOU89fzMM&feature=emb_title inside a post, in a non-Gutenberg environment. What happens is WordPress actually ...
0
votes
1answer
19 views

Shortcode Always Displays Default Attribute Value

My shortcode always uses the default value for the single attribute, reviewstoshow, instead of the incoming attribute value. The incoming value has the correct number (per the second half of the dump ...
0
votes
0answers
4 views

Hubspot shortcode displaying after content

I have a wordpress page writed like this, using a forms plugin named hubspot : aaaaaaaaaa [hubspot type=form portal=6420717 id=d561769e-7aee-4924-85e6-edad58111fe7] bbbbbbbbbbb And on preview the ...
0
votes
1answer
16 views

Line breaks inside shortcode variable

So I made this shortcode for a client that creates an expandable transcription box. It works as intended except if there is a line break in the code. Then it create an extra p tag inside the div ...
0
votes
0answers
15 views

How to modify the fallback message outputted by the video shortcode

The core [video] shortcode in WordPress outputs a fallback message and download link when the video source file is not found or is unsupported. This message usually says: Media error: Format(s) not ...
2
votes
3answers
69 views

How to: How do I make my own shortcodes without plugins?

How do I add a shortcode without plugins? I am going to add a shortcode that will give a count of views on a page.
0
votes
0answers
10 views

Is it possible to pass html code through attributes of shortcode?

I am planning to redesign my Blogging Tools page. I am creating shortcodes to list out each product. Here is a sample of the shortcode [product_display id="bluehost" description="Another best ...
0
votes
0answers
18 views

Shortcode function not showing up on mobile browser

I recently received an email from Google Search Console saying that I have new Mobile Usability issues on my site. I have a shortcode on a page that allows users to sign in and fill in a form and ...
0
votes
0answers
13 views

Make shortcode that allows to select specific custom post

I have a page that is built by using WPBakery Page Builder, I need a custom shortcode function, that gives an option in the admin panel to select which post I want to add to that section. Currently, I ...
0
votes
0answers
11 views

Shortcode to show the number of custom post type taxonomy

I would like to create a shortcode to show the number of taxonomies of a certain custom post type: I would like to show with the shortcode the number of "coupon_stores" and if is possible another ...
0
votes
0answers
22 views

Execute shortcode in backend

So I have a plugin that creates some images like a gallery. I add it to the page with shortcode: add_shortcode('foo', 'foo_add_gallery'); I would like to create an option so that the gallery can be ...
0
votes
1answer
16 views

Pass class to Woocommerce shortcode [relative_products] [closed]

I've been using Woocommerce shortcodes alot these days (Woocommerce 3.8). For a lot of them you can pass "class" as a value - for example products shortcode: [products class="custom-class"] and then ...
1
vote
1answer
31 views

How to add shortcode to HTML file (not showing on website)

Im trying to add a plugin shortcode into an HTML document so that when you clickthe "Music" icon on the site a popup appears with the plugin widget in it. This is the shortcode in the HTML file (...
0
votes
0answers
24 views

How do I verify that a shortcode exists within a post's content?

Assume I had $post->post_content to work with. Within this post_content, supposedly, there was an audio shortcode. How can I test this assumption? The shortcode itself looks like this inside the ...
0
votes
0answers
17 views

Two Pagination in One page with shortcode

I create a shortcode to show posts by category with attributes. I want to show 2 separate categories with a separate shortcode in one page but the pagination connected. If I change pagination in the ...
0
votes
0answers
12 views

Shortcodes and js preloader

Ok, so I've got a simple form that takes an input. It takes a while for the output to display so I'm hoping to add a js preloader and display results incrementally. For the moment, I'm doing all of ...
0
votes
2answers
19 views

How can I display all products from all categories on one page with woocommerce?

BlissCBDWorld.com/store I have a shop landing page that lists all of the categories (don’t mind the rudimentary photoshopped products, I’m changing that 😁). What I want to do is also have a button ...
0
votes
1answer
22 views

How can I edit the final HTML structure of the whole web page

I am creating an online shop web page and I am using the "Almaira Shop" theme. This theme lets me put a page template that haves a lot of customizable sections that I can edit with the "customize" ...
1
vote
0answers
37 views

How to force that styles are enqueued in the header?

I have a plugin processing a shortcode, that needs specific styles. For this I used wp_enqueue_style. As I just need to enqueue the CSS upon certain parameters of the shortcode, I call ...
0
votes
0answers
20 views

Dropdown Menu With Shortcode

I would love some help. I am trying to create a dropdown menu that will allow users to select a city. I need to be able to place this on my site via a shortcode. We have the menu working but ...
0
votes
1answer
15 views

shortcodes not working [dt_carousel & [dt_fancy_image

I've been asked to investigate an issue with a WordPress site that's displaying shortcodes. The site is new to me and I don't know who built it. The shortcodes start with [dt_carousel ... or [...
0
votes
1answer
12 views

how to create custom post type with dynamic category_name using shortcode

I have created a custom post type with shortcode so I can add dynamic attributes from the shortcode function myCPT($query, $attr) { $option = shortcode_atts(array('cat' => ''), $attr); $...
0
votes
1answer
48 views

I am having an issue with this shortcode plugin.. Warning: Illegal string offset 'title'

I have a wordpress site and I am using a plugin that uses shortcode as a widget to pull recent blog posts. In the column I am getting an error that reads: Warning: Illegal string offset 'title' in /...
1
vote
1answer
27 views

Executing a shortcode from a “normal” text/hyperlink

Is it possible the executed a shortcode from a normal HTML? For example: <a href=[shortcode]> press here</a> and when the user clicks the text, the shortcode is called? I Basically I ...

1
2 3 4 5
49