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
2answers
34 views

Echo Extra Shortcode HTML to wp_foot

I'm making a button shortcode that requires to attach extra HTML element to wp_foot for each shortcode added. function action_button_shortcode( $atts, $content = null ) { extract( shortcode_atts( ...
0
votes
2answers
43 views

How to add if statement on WordPress shortcode output

I'm making a shortcode function that collects data from WordPress media library function byn_recent_resources_shortcode($atts, $content = null) { global $post; extract(shortcode_atts(array( ...
0
votes
0answers
30 views

wp_mail email sends twice

I created a button on a User's page. It sends an alert email to the admin. It was sending the same email to me 5 times... but I have made some changes. Now it is sending the same email twice. I have ...
0
votes
0answers
31 views

How can I use a plugin shortcode inside of a html form?

I'm using the Simple Wordpress membership plugin for page access. There is a shortcode that can be used to display the username once logged in. I have a form that submits a mysql query and creates ...
0
votes
0answers
23 views

Shortcode in Shortcode/HTML Graphics and Pictures

I got some problem regarding a shortcode in another shortcode. Here the whole PHP code snippet for the Outer shortcode: function shortStat($atts, $content = NULL){ if(isset($_POST['...
0
votes
2answers
204 views

Custom shortcode works in Elementor editor but not on frontend

I'm used to creating custom shortcodes through my child theme and Elementor, never a problem. However this time something is wrong, when I inserted the shortcode widget in Elementor editor my code is ...
0
votes
0answers
23 views

WPBakery Blog Excerpt showing code

WPBakery Blog is pulling through code like: [vc_row][vc_column][vc_column_text]This is my blog[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width="1/2"] I have selected excerpts ...
0
votes
0answers
31 views

Thumbnail image doesn't show up in Shortcode output

A 'WordPress Shortcode' is being developed to display 'YouTube Channel Thumbnail' and 'Latest Playlist Thumbnail' when supplied with 'YouTube Channel ID' as follows. [yt_insert channel_id="...
0
votes
1answer
8 views

Why is the current page loaded in the pop-up window and not the specified one?

I made a shortcode which I put in the popup. The shortcode just needs to get the content of the page by ID I created in Elementor and show it in a popup with the same design as it is on the inner page....
1
vote
0answers
27 views

WordPress function not being called from jQuery method

I’m very new to WordPress Plugin Development. I’ve been learning and developing my plugin for around 2 weeks now. My plugin is supposed to be a retrieve a question from the WordPress database and ...
0
votes
0answers
17 views

how to add shortcode in plugin and use this plugin

I have a website and I wanted to implement Face ID when registering. I found the Face Recognation plugin functionality to fit perfectly. Only I need this plugin to work on the frontend during ...
0
votes
0answers
20 views

Gutenberg Shortcode Chooser Block

Basically, i want to create a block that shows a popup with the list of my custom post type shortcodes then there should be a link against each shortcode for insertion. Please see attached image of ...
0
votes
1answer
25 views

shortcode executed in the page editor

I am trying to create a really simple plugin that creates a really simple shortcode, but when I insert the shortcode in the editor, and try to save the page I get the following error: "Updating ...
1
vote
2answers
52 views

Get value from shortcode to do something

For a project I want to use advanced shortcodes. Normally I define shortcodes within my PHP. This way it is always the information I have in my PHP-files that I show with my shortcodes (like [...
0
votes
2answers
29 views

Passing function arguments via a shortcode

I have a simple WP_Query that displays posts: <?php function vertical_posts( $title, $category, $num_of_posts ) { ?> <section class="vertical-posts"> <h2 class=&...
0
votes
0answers
61 views

is it possible for a URL to filter by tag

so I have put together a function that filters products by a specific tag and displays their categories. What i want to do, is extend it further so that when the customer clicks the category link ( ...
0
votes
0answers
23 views

Slider shortcode that will write an init script for each shortcode instance in WP Footer

I've been frankensteining this plugin (first time digging into plugins) using examples from Google, but I'm not well versed in PHP. The goal is to generate the init script for swiper.js for each ...
0
votes
2answers
36 views

How to search order using database frontend short code WordPress

I do not have a lot of coding knowledge. How do I add a WordPress searching database shortcode to the frontend using the metavalue as if I were to search for "demo", the metavalue(named as ...
0
votes
0answers
15 views

Custom page with shortcode function

Is there a way I can show just the name and profile picture of logged in user on a page in frontend with shortcode. I tried checking through some solutions but does not provide what I need.
0
votes
0answers
16 views

Shortcode letting user to "join" the multiple user roles

It is possible to create some sort of shortcode which allows users to "join" the particular user role from frontend? Like if user is subscriber by default to let him join also user role such ...
0
votes
1answer
50 views

pass complex json as shortcode parameter

I need to pass complex json with nested array of object as shortcode parameter. For example I need to pass something like this: { "a":"va", "b":{ "b1&...
0
votes
0answers
14 views

I would like to add a review count of a particular website in to my blog and that it should update automatically every time it changes

Hey i would like to be able to add a review count from google reviews or trustpilot of someone else website that i am writing about them in my blog. i would like it to be accurate and therefore update ...
0
votes
0answers
20 views

Enclosing Shortcodes for Tabs

I'm in the process of migrating our site to a new theme. We previously used enclosing shortcodes to have tabs on some of our pages (see two code examples below). The new theme does not have this ...
0
votes
1answer
38 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 ...
0
votes
1answer
37 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 = ...
0
votes
1answer
23 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 ...
0
votes
0answers
25 views

Short code to modify the user profile from the frontend

I am trying to pass a template that I found here to a short code to display on a page on the frontend. Now now I have the following: // profile action hook - catches form submission and acts ...
0
votes
1answer
27 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 ...
-1
votes
1answer
36 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 ...
0
votes
1answer
53 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'...
0
votes
0answers
21 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 ...
0
votes
0answers
19 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($...
0
votes
1answer
14 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 ...
1
vote
1answer
59 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 ...
1
vote
1answer
46 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 ) { ...
0
votes
1answer
35 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(); ...
0
votes
1answer
31 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 ...
1
vote
0answers
16 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 ...
0
votes
0answers
28 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
1
vote
1answer
62 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 ...
0
votes
0answers
32 views

Get shortcode attrs inside AJAX callback function

I need to get the attribute values passed to the shortcode inside an AJAX callback function. With my attempts I get all NULL values. I don't understand where I'm wrong. Everything is within a class. ...
0
votes
0answers
23 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 ...
0
votes
0answers
84 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 ...
0
votes
0answers
22 views

how to display the value of shortcode inserted in options page to frontend

dear wordpress developers, I'm Vietnamese, if the vocabulary I use here is not polite, please forgive me First i have shortcode [test_text] add_shortcode( 'test_text', 'showtext' ) ; function showtext(...
0
votes
1answer
38 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="...
0
votes
1answer
23 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 ...
0
votes
0answers
32 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 ...
0
votes
0answers
52 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 ...
0
votes
2answers
66 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... ...
0
votes
1answer
18 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 ...

1
2
3 4 5
54