0
votes
1answer
13 views

How to use extract shortcode in loop?

Actually I need to gallery in any new post so i use shortcode for making gallery for every new post. I use images and videos in slider. problem is that I have custom html slider need to convert ...
0
votes
2answers
37 views

Return vs Echo Shortcode

Ok, so I've created a short code which echo's some of the output; the problem I discovered is that the values must be returned instead of echo'd. I'm having problems converting the shortcode to return ...
0
votes
0answers
21 views

Custom Loop Using Shortcode in Custom Page Template

I am trying to output a custom loop created using shortcode in a custom page template. Here is the code I am using to generate the shortcode: function archive_sc( $atts ) { // Attributes ...
1
vote
0answers
100 views

Shortcode in posts called by ajax is not working

I am using ajax to load content of post. Functions like the_title() works fine, but unfortunately the_content() doesn't returns any shordcodes( gallery nor tablepress ) data. here is my code: ...
0
votes
1answer
38 views

How to put a block of code between [shortcode][/shortcode] in do_shortcode()?

So I want to put a loop of post behind a 'like lock' thats created by a plugin that uses the shortcode [to_like ID="XX"]content[/to_like]. But instead of the plugin blocking the content, i just get a ...
0
votes
1answer
27 views

Have multiple loops on a page appear after/between page content

I created a function (in function.php) that allows me to put additional loops for different categories into pages: function custom_summary($atts) { extract(shortcode_atts(array( ...
0
votes
1answer
38 views

Using shortcode within shortcode with dynamic variable

So I've written a shortcode to generate a Loop (which shows the most recent posts), the shortcode is simply [loop]. Here's the code which outputs the content of each post (which is the bit causing me ...
0
votes
1answer
43 views

How can I put a custom field as the link of a button shortcode?

I have been working on a custom page template, and cannot seem to figure out how to have a custom field for URL's as the link for a button in the loop. Here is my code <?php echo ...
1
vote
2answers
339 views

Split Content and Gallery

Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode ...
1
vote
2answers
112 views

What are the disadvantages of using global variable?

I am a newbie at WordPress. In my "recent posts" shortcode, I used global $post variable, because the_title() function was giving me page's title, not post's title. I am not exactly sure, but I ...
0
votes
1answer
74 views

Nested loop called with shortcode duplicating the content above the main loop

I'm trying to use a shortcode to call one post from a custom post type and display it inside another page's content. (Basically, we have a custom post type called 'testimonials' and we want to display ...
1
vote
1answer
162 views

IF statement in a do_shortcode

Is it possible to do a if statement in a do_shortcode? <?php echo do_shortcode("[table width='500'] " . if ( have_posts() ) : while ( have_posts() ) : ...
1
vote
1answer
150 views

Function to show only first instance of shortcode

I need to add a function to my theme to remove additional instances of a shortcode in a post. First off I wonder if i'm approaching this wrong, but I have a theme that is drastically reformats the ...
4
votes
1answer
260 views

How to return loop contents

At times, I need to return the output of a loop (usually with WP_Query like in this example) for use in a shortcode or with a filter on the_content. The following code that uses object buffering ...
1
vote
1answer
2k views

How do I get the attributes of a short code from a post?

I am trying to preview a NextGen gallery on my main page (and category pages) to show a single image from the gallery on the main page next to the text from the post that normally shows up. I have ...
1
vote
1answer
220 views

Displaying terms based on loop posts?

I have a shortcode that shows a loop for a custom post type: while ( $loop->have_posts() ) : $loop->the_post(); // do something endwhile; Some of the posts are in categories ...
0
votes
1answer
70 views

Loop output for custom plugin [solution found]

I am trying to update my plugins to be more user-friendly. One of the things i want to achieve is that i want my plugins output (e.g. for description-fields) to use the full functionality of all ...
0
votes
1answer
87 views

loop on page makes shortcode fail

I have this typical WordPress page (page.php): <?php the_post(); ?> <div id="rightcol"> <div <?php post_class(); ?>> <?php the_content(); ?> </div> All works ...
0
votes
1answer
259 views

Shortcode leaves no space for other elements?

I've created my own shortcode. I'm unable to share the code unfortunately ;/ When I use it on my pages it behaves strange. It always has the highest priority. I mean something like that in page ...
0
votes
2answers
5k views

How would I create a shortcode to display a custom post within a page or regular post?

I would like to create a shortcode that will extract information for a custom post, and display it within a Page or regular Post. Specific use case: I have a custom post type "Film" for a film ...
0
votes
1answer
323 views

Output loop to function return?

I'm working on a shortcode function that returns a category image, a link to the category, the last three posts in that category, and another link to the category. See my code below: ...
1
vote
1answer
1k views

Custom Post Type Loop within Shortcode

I'm really at loss as to why this isn't working: I am using a shortcode to display a query on a custom post type + taxonomy, this is the segment of it: // - arguments - $args = ...