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
6 views

Showing custom content from specific function in a page

I have a custom php function that returns some text that I would like to show in a specific wordpress page The fastest idea that comes to my mind, is to return that content through a shortcode and put ...
0
votes
0answers
22 views

Hide content for specific users with id

I want to write a short code so that users who write their id's in it can not see the content of the short code! Example: [hidefrom ids="1,46"]content[/hidefrom] Please help me, I do not ...
0
votes
0answers
8 views

Custom Woocommerce Shortcode based on Purchase

i am a newbie in wordpress and woocommerce and now i have a project that i used elementor to build it and now i need to add a button that i want to show if the user bought a specefic product and hide ...
0
votes
1answer
26 views

How to edit blog page in wordpress? there is no place to put shortcode

I have a shortcode I want to put on the sidebar which appear only on the blog page and the single post page. so I created a field for this shortcode using Advanced custom fields plugin. when I went ...
0
votes
1answer
32 views

WP Query by 4 different taxonomies

I need to make a shortcode that uses the values of four different taxonomies. I am trying to modify code that I have used to query attachments (in media) based off of multiple taxonomy terms, but ...
0
votes
0answers
8 views

How do I write a loop to get and display product list by tag, place in a function and add shortcode to page within admin?

How do I write a loop that gets and displays a product list by tag, place in a function and add shortcode to page within admin so I can display that lsit where i'd like? I have no code :(
0
votes
1answer
21 views

PHP multiple forms, same page, isset($_POST[]) not working?

I have a page with a list of webinars, and a shortcode that displays a form button labeled "Enroll". The form should simply update the user's WordPress profile and redirect them to a page. I ...
0
votes
0answers
16 views

How to use multiple (or array) values in $content of shortcode?

I have a shortcode that fetches some values, first_name, last_name and email from a remote database. I'm trying to write a shortcode that will allow me to print 2 or more of those values within output ...
0
votes
0answers
20 views

how to display dynamic data obtained from external sourced (API) within page content

I have a page that is passed a value as a query string parameter (www.example.com/uid=1234). I need to use that value to fetch some additional data via a 3rd party API and then display the fetched ...
0
votes
0answers
10 views

How to Display Custom Formatted Blog Post with Provide tag name as attribute in Shortcode

I want to make Shortcode where if client pass the name of tag(available or added in blog posts) as attribute then it will show 2 blog post from that mentioned tag. as i cannot ask him to do all html ...
0
votes
0answers
21 views

Create shortcode for get post ID from custom post type with relationship

I have two custom post types: School Podcast There is a relationship between them; each school can have many podcast. (I've created this with Toolset). This is the table that created by Toolset: ...
1
vote
2answers
53 views

i have create shortcode that work but not perfect coding

I want to create a shortcode where content is displayed if user meta is equal to a value It Works but it's code isn't perfect how would you have done? How Can I improve it? Example content display if ...
0
votes
0answers
13 views

WooCommerce: Adding catalog toolbar on homepage

Currently, I'm using the Unero theme and WooCommerce plugin on a custom WordPress e-commerce website. The problem is that Product Catalog ToolBar feature works only on the "shop" page (a ...
1
vote
1answer
24 views

How to add an automatic refresh in Wordpress for a Page/Post or an embedded OneDrive/Excel HTML Code?

I have added an embedded Excel sheet on my website's home page. It is always displaying live data which is changing all the time. But when me or my colleagues view that page, they need to refresh the ...
0
votes
1answer
17 views

To know whether insert shortcode in custom meta box

I build custom meta box that get text and i need to know if user insert shortcode inside and convert the shortcode to his code. for example: inside textarea user insert: Hello Word [contact-form-7 id=&...
0
votes
1answer
31 views

How to link current user to their author page through shortcodes

I need a shortcode to link the current logged in user to their author page but I couldn't make the function workable. Found this code based on another similar question here: <?php if ( ...
0
votes
0answers
12 views

Question about has_shortcode

Hopefully a simple question. I am creating two simple plugins, one for tabs and one for accordions. I have the following code to display an accordion within the tabs. if (has_shortcode($tabcontent, '...
0
votes
2answers
32 views

How can I pass WP_Query results to a plugin?

How can I pass the results of a WP_Query call to a plugin? I've tried passing the data via a shortcode attribute, but I get the error "Object of class WP_Query could not be converted to string&...
0
votes
0answers
27 views

Shortcodes not processing inside post content

I have shortcodes inside my post_content in a custom post type wordpress. But when I echo the post content, all the shortcodes are not getting applied. What I've tried so far: $post = get_post(post_id,...
0
votes
0answers
14 views

Creating a slider shortcode to use with bxslider

So I'm building a shortcode so that I can use with bxSlider (https://bxslider.com/examples/image-slideshow-captions/) but for some reason I am unable to have my javascript work. Here is the example of ...
0
votes
1answer
22 views

Function is printing twice - any suggestions?

My function is returning the results correctly, but for whatever reason it is returning them twice. Any suggestions? It's for a shortcode that queries and lists custom post types matching custom ...
0
votes
2answers
37 views

Custom post type Shortcodes wordpress

I want to Add slider shortcodes. My all slider fields adds properly in shortcode, but the read more button and button link is not displaying. Can you please solve my problem? This my slider code: <...
0
votes
1answer
50 views

Template part inside shortcode, unexpected reult

I am attempting to call a template part via a shortcode. Ive read all about how to do this over and over on this site and yet after having tried a number of things still am unable to call a simple php ...
0
votes
2answers
38 views

Conditional formatting on data fetched from MYSQL

I'm not an expert in PHP and I'm trying to apply conditional formatting on data fetched from wpdb. To be fair, I'm trying to create shortcode for this. My motto is to fetch values for $previous_marks &...
0
votes
0answers
11 views

Multisite - How to get blog posts from main domain and show in all other subdomin

I have created multisite network and I want to get some ( 3-4 ) blog post from main site and want to show in child websites in home page with the help of shortcode. I am using the same theme to all ...
0
votes
2answers
39 views

Gravity Forms: How to add PHP function to confirmation conditional shortcode?

In Gravity Forms, I have a confirmation set up with various conditional shortcodes. Example: [gravityforms action="conditional" merge_tag="{:3:value}" condition="contains"...
0
votes
1answer
21 views

wpdb->query returns different value to phpMyAdmin

I am trying to build a shortcode that will query a db and sum. Here is what I have so far: function my_plugin_name_count_people() { global $wpdb; return $wpdb->query ("SELECT COALESCE(SUM(`...
0
votes
1answer
45 views

shortcodes, custom php and their errors

UPDATE- After some suggestions I changed this over to using the $wpdb API. The following code is retuning a '1' instead of the actual result count which should be '2'. //a function is a block of code ...
1
vote
1answer
19 views

Creating a short code with php inside

I am trying to get this code: public function add_request_quote_btn() { global $product; $product_id = $product->get_id(); $wc_quote_show_button = get_option('wc_quote_show_button'); ...
0
votes
2answers
25 views

A shortcode nested inside a shortcode

This is my first time asking a question here. I'm kinda stuck on how to do echo do_shortcode(); inside a shortcode. I tried googling for an answer but to no avail. I'd like to know if it is possible ...
0
votes
1answer
20 views

How to display the post using a shortcode in WordPress?

I am trying to display all the post on my page but it's not displaying. I am using the below code and I added the shortcode gridPost on my page. I am getting the only UL LI but not getting the title ...
0
votes
1answer
36 views

How to display the categories on page using shortcode?

I am trying to display the categories name on my page but it's not displaying. I am using the below code and I added the shortcode gridCategories on my page. I am getting only array function ...
0
votes
1answer
24 views

Adding variable in Wordpress shortcode

I have this shortcode [post color="XYZ" width="980" height="610] I wish to pass $color in color="". Here, $color is fetched from dynamic URL: www.mydomain.com/check/?...
2
votes
1answer
13 views

Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}

There's an external website that I'll be referencing within my posts that uses the same static format for their pages. Let's say it's website.com/view/1111, website.com/view/1112, etc. What I want to ...
0
votes
0answers
24 views

How to disable single page for specific posts?

I need to disable single pages for specific posts, but only after specific condition. My code is here: add_shortcode('list-posts-basic', 'ant_post_listing_shortcode'); function ...
-2
votes
1answer
21 views

Invalid argument supplied for foreach()

I try ti get some value from a request and display it in a loop. I ve already use this system in an another function and that it worked but in this not. I get the message : Warning: Invalid argument ...
0
votes
1answer
19 views

change the h3 subtitles of the wordpress gallery shortcode

When I create an image gallery in a WordPress entry with shortcode [gallery] and put their titles on them, they appear in H3 Any way to change them to be on h4? Example of a gallery image created in ...
0
votes
1answer
22 views

List all blogs, but exclude the main site

I am using this function that gives me a shortcode I can paste anywhere on the site. It lists all blogs in the multisite network a user has, but I would like to hide the main site from the list. Can ...
0
votes
0answers
30 views

Why is my shortcode not working?

I m making a plugin and i need to connect to db for get some values that i will put in the content of new page that will be created. It s strange because this morning it worked and now there is a ...
0
votes
1answer
47 views

How to display content if user meta data isn't empty with shortcode

I need to display content if user meta data isn't empty Example : [empty_user_meta="last_name"] Show only if last_name is not empty. [/empty_user_meta] Code don't work : add_shortcode(...
0
votes
1answer
36 views

Shortcode Attributes to Return different $_POST

I am creating a solution to enable front end editing of custom fields, I am using hidden input containing the custom field to send via POST request to an editing form, the form contains default value ...
0
votes
2answers
34 views

How to display total user count by specific role in WordPress as statistics?

i want to display in my Home page total user count by specific role in WordPress as statistics I already created Role (subscriber, contributor) and i want to show the total users for each of those ...
0
votes
1answer
32 views

JS working when used normally but not in wordpress

I have a shortcode that prints a simple form, a button is used to submit the form. The problem is that when it's pressed, the form gets submitted normally, ignoring the js function. I can't understand ...
0
votes
0answers
24 views

Make the product page as homepage WooCommerce

I'd like to make the product's page as homepage. But this product's page I created with Elementor Pro. I'm trying to use the shortcode [product_page id=99]. But it imports the standard page of theme, ...
0
votes
1answer
46 views

how to add shortcode widget at end of main blog page

not able to add subscribe to newsletter shortcode at end of blog page. want to add after pagination and before footer. anybody know how to add? the page i am working on Website
0
votes
0answers
33 views

Time Stamp In A Wordpress Post Title That Does Not Keep Refreshing

I have a short-code that uses PHP to echo a time stamp ala: 1595140137 When I use that short-code as the default post title in new post, the post title changes with each page refresh, and in the ...
0
votes
2answers
24 views

How to check if a post has any one of many shortcodes?

I want to check if a post has one of the following shortcodes, wpdocs-shortcode-1, wpdocs-shortcode-2, wpdocs-shortcode-3. If it found any of those shortcodes, then do enqueue scripts and styles. ...
0
votes
0answers
25 views

Shortcode show error while editing post

I have created a shortcode to show plugin template through Post When I am Add and view Post its Work well but when I am returning to edit post the page of the editor was not showing there only and a ...
0
votes
0answers
46 views

How to get archive posts of current term with additional custom taxonomy filter shortocde

I have a need for getting the posts of the current custom taxonomy and also filtering those posts with another custom taxonomy ... Custom Post Type = 'provider' Custom Tax 1 = 'locations' Custom Tax 2 ...
0
votes
1answer
13 views

How to pull sticky post permalink inside php?

So, I have the following code written inside my function.php. I use it on my blog post to display the sticky post, but my only issue is I'm not sure how to get the permalink inside my HTML. Also, how ...

1
2 3 4 5
50