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

Using dynamic tags within text

So I created some dynamic tags. After my Gravity Form is submitted it creates a post. The post has the contents of the dynamic tags listed under the body so this is all working fine. The question is, ...
2
votes
1answer
40 views

AddToAny shortcode in the loop

I try to add addtoany shortcode in my custom loop page but the shared link stays always the same for each posts in the loop. <?php global $post; echo do_shortcode('[addtoany url="' . ...
0
votes
0answers
11 views

Hide download option video shortcode

Is there a way to hide the video download option (not all the controls) with the shortcode [video]?
1
vote
1answer
18 views

Missing image in gallery shortcode in custom feed

I have problem with custom gallery shortcode and missing first image in each gallery block. For example: [gallery ids="1,2,3,4,5"] show only 2,3,4,5 pictures. This custom shortcode is part ...
0
votes
0answers
15 views

Get title of page containing post grid within the posts

I have a page containing a post grid. Within the text of these posts I want to use a shortcode to display the title of the page containing this grid. So, when my page title is "test" I want ...
0
votes
0answers
17 views

Show the tag if the custom field is set to “Yes”

Using the following code and shorcode, I display 10 tags in the basement of the site: function getTagListfoot($classes = '') { global $post; wp_tag_cloud( array( 'taxonomy' => 'tags_type', '...
1
vote
1answer
21 views

How to exclude category ID from Looper in Wordpress

I'm trying to exclude 2 (and potentially more) ID's from my loop, that displays all categories that have posts. The category ID's i'm currently trying to exclude are 1 and 19. I'm very new to PHP but ...
0
votes
1answer
47 views

Can Someone Help me to Correct my shortcode for displaying a category?

Actually the problem is in this code that is, If I put the id directly in "terms" of any post type like; [arts-list 10], then this type of post which contains this id displays the posts on ...
1
vote
1answer
32 views

Register visits of my pages in wordpresss

I have a shortcode that obtains the name of the person logged into wordpress, I would like that shortcode when the person enters a page where I have my shortcode create a .text file and save their ...
0
votes
2answers
21 views

Display CPT Category List as Shortcode

I'm trying to output the current post categories for my 'portfolio' custom post type as a shortcode. At the moment I have this snippet in the functions.php function shows_cats(){ $page_id = ...
0
votes
0answers
5 views

Shortcode My-Listing ho bisogno del conteggio dei post(listings) per ogni Categoria(Regione) filtrata x taxonomia(es:Lombardia)

Shortcode My-Listing theme scusate potete dirmi come creare un shortcode avrei bisogno del conteggio dei post(listings) per ogni Categoria(Regioni) filtrata x taxonomia(es:Lombardia)
0
votes
0answers
8 views

Custom WooCommerce My Account Page

I have a custom WP Plugin that displays custom php pages and I need to add the My Account shortcode to this page. Because it's a custom php code page it won't display the my account area. It just ...
1
vote
1answer
31 views

Wordpress Code Standards and Working $link Parameters In Shortcode

I Have this snippet code, add_shortcode( 'parent-child', 'taxonomy_hierarchy' ); function taxonomy_hierarchy( $atts ){ extract( shortcode_atts( array( 'link' => true, 'taxonomy' ...
0
votes
0answers
9 views

Shortcode of count of listings separete by category(ferrate) and region(Lombardia)

Hello can same one help me ? i Need to have a count of listings(posts) separate by category and regions in my-listing Theme like Lombardia (5) Listings Piemonte (2) Listings Toscana (12) Listings
1
vote
1answer
14 views

Shortcode with a foreach and arguments

I'm digging into shortcodes expert level 😄 I made some searches and I really think I'm on the right path but I need your help because something is missing me (probably because I don't know very well ...
0
votes
0answers
16 views

How to run [products] shortcode in AJAX with loading the product label

This question is related to this plugin https://woocommerce.com/products/woocommerce-advanced-product-labels/ that is located at woocommerce.com. My question is, I'm trying to display the woocommerce ...
0
votes
0answers
21 views

Can Someone help me to create Short Code for displaying a category posts

Can Someone help me to create shortcode for displaying a category posts... // Custom Post type coding starts from here (for my remembrance) function diwp_arts_custom_post_type(){ // here I am ...
0
votes
1answer
14 views

How do I use a plugin's shortcode attribute value in another function?

I have a plugin as a class, where I am using a shortcode attribute to populate the $outlet variable. However, despite sanitize_text_field($atts['outlet']) returning the expected string , $this->...
1
vote
1answer
39 views

How to display Common posts from specific Tag & Category with Shortcode

How to display posts that are common in Category A and Tag A, and I want to display posts by shortcode so that the Shortcode can be used on multiple locations with different category Ids and Tags. I ...
1
vote
0answers
31 views

Shortcodes — Using add_action, add_filter in the shortcode

A client wants the following: User clicks on a specific button which takes them to a partner's site. If this is their first time clicking the link, they need to accept terms and conditions. If they'...
0
votes
1answer
21 views

displaying content that includes shortcodes within an echo

I have created a custom comment system, when people enter in video shortcodes it doesn't display the video but just echo's out the shortcode. I understand the do_shortcode(); command but the comments ...
0
votes
1answer
41 views

Wordpress Shorcode Display hierarchical taxonomy [child, parent]

I have a slight problem to display the parents of taxonomy in wordpress. (CPT=property and tax = property_city) I did a little research to figure out what to do. but I can't quite figure out how to ...
0
votes
2answers
30 views

Execute shortcodes in PHP

I have a geolocation shortcode which i am adding in the post editor to display different information based on user's location, works perfectly by having it in the post page content. How can i execute ...
1
vote
3answers
33 views

Get term count on a category page

I want to display a count of items in my header, a count of how many items are in the current category... Example: User goes to "T Shirts" > in the header it says "20 Items" --- ...
0
votes
1answer
19 views

From a shortcode I want to pass a value to display a different page

I have a page with a shortcode that displays a dropdown. I just can't figure out how to return that value to a function/page to show the resulting information. The second page would take that value ...
0
votes
1answer
33 views

How to write a custom shortcode name book?

<?php add_shortcode('Book','book_shortcode_templete'); function book_shortcode_templete($atts, $content) { $attributes = shortcode_atts( [ 'id' => 0, ...
1
vote
0answers
9 views

Add a specific part of current category page url to shortcode

I have the following URL: website.com/category/xyz, where xyz can be hundreds of different words. I use a table plugin for displaying my content all throughout the website, and I want it to filter me ...
0
votes
0answers
11 views

Shortcode not working in Jetpack Top Posts & Pages widget

I've added [year] shortcode to some of my posts' titles. I used this in functions.php to enable this shortcode: add_shortcode( 'year' , 'current_year' ); function current_year() { $year = date(&...
0
votes
1answer
16 views

How to check if short code is present in template?

In a plugin I declared a shortcode, but I want to enqueue the scripts only on those pages which have the shortcode. I tried this: global $post; if ( is_a( $post, 'WP_Post' ) && has_shortcode( $...
0
votes
0answers
23 views

Shortcode do not return the right data in post

Trying to make a CD plug-in. But cant seem to get the data rows in the shortcode.. i know it cant echo in a shortcode, but how Can i get, lets say a top 10 CDs in a post with a shortcode? hope someone ...
0
votes
1answer
15 views

Shortcode with loop stacks output

I found some shortcode to display a custom post type, but it's not display how I envisioned. Originally the shortcode only added the title from my custom post type, but I modified it to also show the ...
0
votes
0answers
15 views

Object Orientation: Access attribute from outside shortcode wordpress

I'm new to object orientation and I'm trying to create a class so that I can get the attributes set in the shortcode from a template file. But with the code below I still can't access the attribute. ...
0
votes
0answers
27 views

How to include shortcodes and pdfs in WordPress search without plugin?

I have a WordPress website using Avada theme. The website uses an inbuilt WordPress search tool which searches only posts. The website uses shortcode to add toggle/ accordion etc. I want to include ...
0
votes
1answer
24 views

Replace background image with post thumbnail in shortcode

So, I'm trying to pull the featured image of posts in via a shortcode. But I want to replace the inline style of setting it as a background image and have it returned as an img tag instead. <?php /...
0
votes
0answers
13 views

Color on Shortcode insert that creates a button

I am trying to insert a button with shortcode into my Elementor editing tool. Creating the button works, but it seems to take the color from the theme, which I can't seem to change. So I was trying to ...
0
votes
1answer
17 views

Return multiple values ​in a shortcode attribute

Today the shortcode I created below is working normally if I pass only one value, however, now I am trying this shortcode so that the attribute can receive multiple values. The idea is for the ...
1
vote
0answers
24 views

How to display data from custom table in wordpress phpmyadmin

Thanks in advance could anyone here help me, I would like to display the value from the phpmyadmin database in wordpress, The value was stored from the dropdown form and I want display that value in ...
0
votes
0answers
18 views

How to call function in WordPress on button click?

I am new in WordPress plugin development. how can I call to function on button click with wordPRess shortcode? <?php /** * *Plugin Name: Testing *Description: **/ function showMessage(){ ...
0
votes
0answers
19 views

shortcode doesnt work on excerpt

my shortcodes doesnt seem on archive page excerpts.you can see an example excerpt: https://unit-test-data.deniz-tasarim.site/2011/03/15/ here is related code with excerpt in my theme files: archive....
1
vote
0answers
18 views

Calculating a large number of MYSQL queries as customshort codes, slow

I am using wordpress and building a dashboard. There are a lot of complex MYSQL queries that I am running in order to return results from the DB. I am returning these as custom short codes in ...
0
votes
0answers
22 views

Adding Author URL to Nav Menu via Shortcode

I'm looking to add the Author URL to the Nav Menu via a shortcode. Here's the shortcode I registered: add_shortcode( 'author_url', function() { return get_author_posts_url( get_current_user_id() );...
0
votes
1answer
30 views

Wordpress messes up with data attributes in shortcode output

I have build a shortcode to insert a call to action text and button/link. The button/link should open a modal window with a contact form. So I added data attributes to the button/link for Bootstrap ...
0
votes
1answer
36 views

How to make my shortcode load scripts and styles, from within the plugin?

This sounds like a silly problem, but I was searching for an answer, and couldn't find anything. And the things that I did find, I tried and didn't work or were very vague. Content My Problem What I ...
0
votes
1answer
12 views

Checking if looped item has a parent inside a shortcode

all I want is to check if the custom post item in the loop has a parent. I am using this inside a shortcode. I could not find how to access the property from inside the loop. Thank you my dears $q = ...
0
votes
1answer
16 views

Restricting shortcode for users

anyway to block any user /role(except the admin) to use shortcode? i want to keep some specific shortcode secret. if somehow users come to know, they cant use it. if only admin writes the shortcode it ...
0
votes
0answers
6 views

snippet code to show logged in users their last purchased woocommerce product,

Please i need a code snippet to show woocommerce users their last purchased product, let it show the product name, Date of purchased and time, please i want it to be a shortcode which i can add to any ...
0
votes
1answer
22 views

Adding author option to [products] woocommerce shortcode

I am trying to modify the [products] shortcode usage: https://docs.woocommerce.com/document/woocommerce-shortcodes/#section-11 What I am looking was passing the author id from short code e.g [products ...
0
votes
0answers
14 views

Use WordPress Shortcodes in TinyMCE5

I am using Wordpress on my site. I wanted a visual editor on frontend of my site. Gutenburg isnt allowed to be put on frontend, and visual editor looks old, so directly using TinyMCE was the best ...
0
votes
1answer
19 views

When echoing my own shortcode, it keeps adding a 1 at the end of my blogpost

I am currently building my own plugin and testing things around, to make sure everything works. I used register_settings() to create a form on my backend, I filled it with information and have no ...
0
votes
0answers
9 views

Why is this shortcode moving?

Really strange bug. I have a shortcode in this page that imports this generated file into a table. In the last few years, when I edited the page, the shortcode for inserting the text would jump above ...

1
2 3 4 5
51