Skip to main content

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
1 answer
122 views

How do I reopen the (Popup Maker) after entering the correct password for a password protected page?

There is a password protected page. There is a link in the single page, clicking on it opens the "Popup Maker" modal window. Content from the password-protected page from point 1 is loaded ...
VladSiy's user avatar
0 votes
1 answer
162 views

Trying to create a shortcode to display categories with a specific product tag

I currently have the following and it is not working: If I put the shortcode [tagtagtag=246] i get an array to string error function get_categories_with_product_in_tag( $atts ) { $atts = ...
challenge2022's user avatar
0 votes
1 answer
26 views

list of custom post by custom field in frontend

I'm trying to list the custom posts associated with a client. I have a CPT "assessment" with an ACF custom field "customer". The short code would go to a specific page "my ...
Manuel Hermida's user avatar
0 votes
1 answer
157 views

How can I create a shortcode to show the number of posts of actual day?

I want to create a shortcode to display the posts posted on actual day. I found this code: show number of posts posted today And I'm trying with it, but return 0 function ts_day_f() { // we get the ...
Velask's user avatar
  • 11
-1 votes
1 answer
37 views

How i make a shortcode from this code

im trying to change this code into a shortcode because the method that im using right now is calling the whole file instead, and it a bit slow. <?php /** * The template for displaying Archive ...
Wally's user avatar
  • 1
0 votes
1 answer
210 views

Shortcode with 'year' parameter

I would like to display posts with a 'year' parameter. For example: to display posts from 2020, the shortcode should look like [archived-posts year="2020"]. I have tried my code below but it'...
Marcio's user avatar
  • 129
0 votes
0 answers
23 views

Spoof the admin panel on the client side? [duplicate]

I'm working on some admin dashboards with a plugin that uses shortcodes that are not available in the admin panel (can't use do_shortcode() - I tried). However these are dashboards that I really want ...
techiechic's user avatar
0 votes
0 answers
26 views

Image Caption Shortcode Broken upon update

I have the following code which I use on my WordPress site: function ced_get_featured_image_caption() { $get_description = get_post(get_post_thumbnail_id())->post_excerpt; if (!empty($...
Benson's user avatar
  • 1
0 votes
1 answer
18 views

Unable to pull in custom product attribute in shortcode [closed]

I have this code working directly on a page. But when I try to add it to a shortcode in the function.php it is not working. It will not pull in the author (or the date). <?php //LIST ALL ...
Karen's user avatar
  • 11
1 vote
1 answer
398 views

Gutenberg Block showing invalid content on edit

My requirement: I am trying to create a simple gutenberg block which will have a textarea and a dropdown. Once a user has provided the details I want to save it as a shortcode in DB, but when the user ...
Raunak Gupta's user avatar
1 vote
1 answer
235 views

Shortcode To Display Post Custom Field Value Inside Excerpt

I want to create a shortcode that pulls value from a custom field of a post and returns that value inside excerpt. I already have a function for the custom value: function geo_name_function( $atts ) { ...
Discover's user avatar
0 votes
1 answer
63 views

Change user meta value with shortcode

With shortcode, i want to create form to change the car's name of user function wp_change_namecar( $atts, $content = null ) { if (is_user_logged_in()) { $user_id = get_current_user_id(); ...
Olivier's user avatar
  • 19
0 votes
1 answer
446 views

echo something inside a shortcode

I'm a frontender, so i'm not so used to work with php. But I need to solve something. I'm adding a shortcode within the single-product template, and inside this shortcode, I need to echo the slug from ...
Michael Fynbo Kjergaard's user avatar
1 vote
0 answers
39 views

shortcode in snippet plugin not work

add_filter( 'woocommerce_product_tabs', 'wpb_new_product_tab' ); function wpb_new_product_tab( $tabs ) { // Add the new tab $tabs['test_tab'] = array( 'title' => __( 'Size ...
Noam Yakov's user avatar
0 votes
0 answers
142 views

insert og image link in wordpress post

I am trying to extraxct the og:image url is there a wordpress plugin that extract og:image url from an external webpage url i need a shortcode to insert that image in my post
Ammar Berjas's user avatar
1 vote
1 answer
206 views

How can I get content inside one shortcode to another shortcode?

I have 2 shortcodes, [ref] and [references]. I need to get the content inside the [ref] shortcode and output it when the [references] shortcode is called. For an example; INPUT - This is some content ...
Nisal Devinda's user avatar
0 votes
0 answers
81 views

How to add pagination in Terms

Hello on my website I have created a page where it will show all of the Woo Commerce tags in the store in list format. The problem here is that I am unable to paginate them. I have tried ...
Ashish Jat's user avatar
0 votes
0 answers
671 views

How to cache a custom API call?

I build a little Python API and would like to cache the responses for 24-hrs. As I use it in a shortcode like [google keyword="example"] it will always do the API-call once I open the ...
patrickgerard's user avatar
0 votes
1 answer
43 views

Weird failing request

Below there is a simplified version of the concept I'm trying to make work. In a post, I'm manually inserting this core Image block: <!-- wp:image {"id":7} --> <figure class="...
Konstantinos G.'s user avatar
0 votes
1 answer
68 views

Wordpress post pagination continuous [duplicate]

I have these shortcodes which I am using as links in my front end to get the next post and previous post. When I get to the last post it just keeps reloading the last post again. How can I get it to ...
Joel Reed's user avatar
0 votes
0 answers
183 views

Not able to remove caption shortcode from the content

[caption id="attachment_6" align="alignright" width="300"]...Some Text...[/caption] I am unable to remove caption shortcode from the content of the post. I have tried ...
Anshu Jindal's user avatar
0 votes
0 answers
282 views

How to add a shortcode which runs a .php file for the current post

RESOLVED: In the end, I found a non-php coding solution, but thank you to those who replied! My client is using Woocommerce Bookings for tours which are saved as Woocommerce Products. I have just ...
Beth's user avatar
  • 9
0 votes
2 answers
376 views

Pagination not working - FrontPage

I'm trying to add pagination through function.php. No Output! What I'm missing? function simpleblog() { $query = 'posts_per_page=6'; $queryObject = new WP_Query($query); // The Loop... ...
Chinmay Rajyaguru's user avatar
0 votes
1 answer
23 views

Using a WP shortcode in Homepage

my WP blog is just a part of my homepage/serverspace. I would like to know if it's possible to use a WP shortcode outside of the WP folder, meaning, not inside of the WP template but in another html ...
Rike's user avatar
  • 1
0 votes
1 answer
547 views

post meta value as shortcode parameter

i am using a plugin (download monitor) to display downloads via shortcodes. also using an addon for download monitor - gravity forms lock. for that, the shortcode, which i must include in the same ...
vulgarbulgar's user avatar
0 votes
2 answers
55 views

get_post_meta shortcode returns empty field

I'm trying to create a custom shortcode that will allow me to input custom order field data into an auto generated outbound email template via the Custom Order Status for WooCommerce plugin. My ...
rabiancone's user avatar
0 votes
1 answer
806 views

custom field value as shortcode parameter

i am using a plugin (download monitor) to display downloads via shortcodes. the shortcode has a single parameter, which is the download's ID: [download id="123"] i'd like to be able to ...
vulgarbulgar's user avatar
0 votes
0 answers
279 views

Customizing the wp_video_shortcode output with add_filter

I am trying to add onmouseover="this.play()" onmouseout="this.pause()" to the default <video element in Wordpress. I am using Gutenberg block editor. By default, this is what ...
Srivishnu Ramakrishnan's user avatar
1 vote
2 answers
562 views

How to change page title (from a plugin) in twentytwentyone theme

First, is it even possible to change the page title from a plugin (specifically, from a shortcode defined in a plugin)? This answer says no, but there are certainly reasonable use cases for it. Like, ...
GHolmes's user avatar
  • 63
0 votes
1 answer
342 views

How to add a shortcode function that returns the taxonomy slug of the actual post within the loop

Circumstances: I have a CPT called "designs" and a taxonomy related to it, called "project_category" so that I can assign a category to each design. I'm building the template for ...
Ernest's user avatar
  • 53
0 votes
0 answers
58 views

Shortcode do not return a value

Just wondering, why shorcode do not return a value. Here is an example. add_shortcode( 'terms', 'x_get_custom_terms' ); function x_get_custom_terms( $atts, $content = null ) { $atts =...
anton's user avatar
  • 1,033
0 votes
1 answer
145 views

How can I collect and output all attributes of all executed ShortCodes?

I would like to collect all attributes of the shortcodes that are stored in a page in the ShortCodes and then output them all. I do these in a Plugin. 1.) Set a global Variable in init.php ==> $...
Severin's user avatar
  • 55
0 votes
1 answer
279 views

Shortcode not appearing when used as post content in wp_insert_post() or possibly, shortcode not being registered at all

I have a plugin which creates a page upon activation and then removes it on deactivation. As part of the page creation, I wanted to use a shortcode in the post content, so I added a shortcode with ...
T Nguyen's user avatar
  • 113
0 votes
1 answer
788 views

Getting Page Content Using Shortcode

I have a menu page that contains dishes (food) for the week and I am trying to display that by inserting the shortcode on home page. Nothing shows. I'm not sure how to use return and get the content. ...
Harold Aldersen's user avatar
0 votes
1 answer
109 views

i want to show a modal when user lands on home page very first time

what i want is when user lands on home page for very 1st time i want to show a specific modal. i managed to record the first login of user but what i cant get is how to track user first time landing ...
Talha Arif's user avatar
0 votes
1 answer
795 views

Check if parent page has child page of certain slug

I currently have a function that checks to see if the page is a parent, and if so, do stuff. But I also want to check to see if the parent has a child page that has a certain slug. Basically, how ...
Garconis's user avatar
  • 144
0 votes
1 answer
151 views

Block error message in foreach loop when looping through ACF field

I have 2 Custom Post Types (created with CPT UI and ACF) "Global" and "Personal". The idea is for the user to reference a "global" post by displaying the image (linked) ...
DCEXC's user avatar
  • 7
0 votes
0 answers
66 views

Shortcode not working in CPT taxonomy

This shortcode is working for Post, Page, Tag, Category at the title but not print output in CPT Taxonomy. Also, I want this should also work for Description in all Post, Page, Tag, Cat, Tax. It means ...
Puneet's user avatar
  • 47
2 votes
1 answer
475 views

How to render complicated shortcodes

I hope you all having a great day. I'm developing a video player plugin with custom shortcodes and stuff but I'm having a problem with the shortcode render. Currently, my shortcode content is rendered ...
theBrogrammer's user avatar
0 votes
1 answer
677 views

Short code template + ajax

I am doing a simple page that would work a single page inside Wordpress using Ajax. So to do this, I create a template page with a short-code in it. But the thing is that I really can't do ajax work ...
Marcos Felipe Donadeli Gonalez's user avatar
0 votes
1 answer
503 views

How to reload the shortcode content when the database is changing

I use Wordpress plugin: snippets to show some data in database. Everything is OK, however, when I change the content in the database. After that I refresh many time in the page. And the content is not ...
ho quoc dung's user avatar
0 votes
0 answers
104 views

Shortcode not working inside div html

header.php <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v10.0&appId=MyAppIDHere&autoLogAppEvents=1" ...
Jakes's user avatar
  • 1
0 votes
3 answers
855 views

Using a custom shortcode from within the template of a shortcode plugin

I've written a custom plugin, ta-intentclicks which is used as a shortcode: [ta-intentclicks count="3" category="SEC-EDR"...] Within this shortcode I'd like to use another ...
commadelimited's user avatar
0 votes
1 answer
79 views

Custom shortcode for displaying user based on a role parameter

I've created a plugin that with a shortcode displays all users with the custom role "ansatt". This works perfectly fine, but I'd like to be able to set the role as a parameter within the ...
André Giæver's user avatar
0 votes
1 answer
584 views

Are Shortcode Attributes Always Passed As Strings?

Does the id in a shortcode such as [reusable id='7'] or [reusable id=7] always get interpreted by shortcode_atts()as a string regardless of whether the integer is in single quotes or not? I'm trying ...
mrfisch93's user avatar
0 votes
1 answer
387 views

Shortcode Not Working in Slider When Added To Post Title

I've coded a shortcode to add manually to specific post title fields so i can style part of a title add_shortcode( 'green', 'green_shortcode' ); function green_shortcode( $atts, $content = 0 ) { $...
Brad Dalton's user avatar
  • 6,926
0 votes
1 answer
125 views

Create a CPT to edit Shortcodes Atts

I have create a carrousel and display it with shortcode and passed the image and text as attributes. However, the shortcode end up being to hard to read and edit when needed. Not user friendly. [...
stemon's user avatar
  • 155
0 votes
2 answers
171 views

Render Modula Plugin Shortcode On Ajax Request

I am using Modula Plugin to speedup the galleries creation process. It works wonderfully but I don't understand how to render it correctly on the ajax call. I read through the available posts on ...
iuriiGav's user avatar
0 votes
1 answer
301 views

Custom Shortcode with Dynamic Button

I am lost as to how to create a dynamic button shortcode. Depending on the post ID a specific application form is served in a popup by clicking on a button labeled 'Apply'. At the bottom of the page ...
Deirdre Nic's user avatar
0 votes
1 answer
320 views

Shortcode not work in picture source srcset tag

I have in my WP plugin: <picture> <source srcset="[bloginfo key='template_url']/images/image.webp" type="image/webp"> <img src="[bloginfo key='...
user203728's user avatar

1
3 4
5
6 7
56