Tagged Questions
1
vote
0answers
14 views
Add button to kitchen sink toggle
I have created a simple function along with a shortcode, my goal is now to add a button in the sink toggle of wordpress so that the user doesn't have to type anything.
Is this hard to achieve? how ...
0
votes
0answers
24 views
Run function from parent on child site
I'm running a Multisite wordpress installation and have a couple of child sites.
Im trying to run a script from the main page on one of the child sites. It can be a shortcode [pro_display_zone ...
0
votes
0answers
45 views
Customize wp-caption output
I'd like to customize the output for the wp-caption shortcode. I need to put the attachment full-size URL wp_get_attachment_image_src($post->ID, 'full')
function custom_img_caption_shortcode( $a , ...
0
votes
0answers
31 views
Figure element with multiple image short code
I have a short code I developed that goes like this:
[figure description=""]
[image src="" title=""][/image]
[image src="" title=""][/image]
[image src="" title=""][/image]
[/figure]
What it does ...
0
votes
1answer
98 views
Shortcodes, output buffering, and WordPress functions
I have a couple of long forms which I want to output as shortcodes. Shortcode API indicates that
If the shortcode produces a lot of HTML then ob_start can be used to
capture output and convert ...
0
votes
0answers
17 views
Printing shortcode as it is for demo purpose [duplicate]
I would like to show demo to my client.
So I wanna print the shortcode as it is. For example like this
[rawshortcode][gallery][/rawshortcode]
So all the shortcodes I wrap within rawshortcode ...
0
votes
0answers
40 views
How to create a shortcode that lists products by category
Hi I d like to create a shortcode that lists products of a certain category.
I ve used the following code to register products and categories:
add_action('init', 'catalog_init');
function ...
0
votes
2answers
37 views
How to use author meta in shortcode?
I am trying to create a shortcode that will return a link to a book on Amazon with a specific affiliate tracking code specific to the author. I created a user option called "amz" to hold the author's ...
0
votes
2answers
54 views
Using multiple line variable inside a function?
I am using the commenting system to all users to add a private note that only they can see to posts and I am using the wordpress comments system to do it. I wrote a function to call the logged in user ...
0
votes
1answer
152 views
Custom registration form in shortcode getting internal server error 500
I created a custom registration form which works fine when used as a custom page template. I needed it as a shortcode so I created a shortcode using the function below
/* Custom shortcode */
function ...
0
votes
2answers
46 views
Shortcode of a function
I got this function and i want to make the contents divs of "foreach" as return. How can i do that?
<?php
$args = array( 'numberposts' => 6, ...
0
votes
1answer
659 views
Adding Shortcode to Text Widget
At the moment, I'm running WordPress v3.2.2 (soon to upgrade to v3.4.2), and am trying to insert shortcode to insert Issuu into a text widget on our sidebar. The WordPress plugin I installed and am ...
1
vote
1answer
96 views
How to display posts by current user in a drop down
I am trying to write a shortcode that works in conjunction with Contact Form 7 to display the current user that is logged in posts.
I have been able to get it to work with regular posts using this ...
0
votes
1answer
90 views
Adding a Tag Parameter / Filter to My Shortcode
I have this plugin that displays category featured image thumbnails for each post via shortcodes.. like so,
[categorythumbnaillist 3] (3 being the category of course)
I would like it to only show ...
0
votes
1answer
284 views
AJAX function not working [closed]
One person on the site wrote a function, but I do not know why it works. This function displays a random quote. The functions implemented the ability to download new quotes via AJAX (link New Quote), ...
0
votes
2answers
72 views
Using locate-template & shortcodes doesn't appear to work
For organisation, I'm trying to split up the functions.php file into separate files. In particular the functions for shortcodes in a separate file, with the shortcodes being defined in functions.php. ...
3
votes
2answers
362 views
Use AJAX in shortcode
I have the following code to the shortcode to display a random quote.
Question: how to make a button display a new random quote? I mean, that would hit the button and show you a new quote (without ...
0
votes
2answers
342 views
Stripping shortcode from custom excerpt function
I'm using the following function to create a custom excerpt for my homepage and categories pages so I can do it by character count and have a custom "read more". However, I have captions shortcode ...
1
vote
1answer
146 views
Adding option to Gallery shortcode
just starting out in WP dev, and I'm looking for any guidance I can get. What I'd like to do is use a hook or filter to add my own option to the core WP gallery shortcode. I would want it to work just ...
0
votes
1answer
119 views
Testing for a shortcode using a function. 404 page throwing PHP Notice
I'm using the following function (can't remember where I found it, but I think it was written by pippin so thanks to him) to test for a shortcode.
function has_shortcode($shortcode = '') {
...
0
votes
1answer
97 views
display custom portfolio tags
This is a part from the code that is used to display portfolio categories:
$post_cat = array();
$post_cat = wp_get_object_terms($post->ID, "portfolio_category");
...
1
vote
1answer
80 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 ...
1
vote
1answer
118 views
Shortcode with custom content attribute?
I am creating a shortcode for a client site that should display an image and a saying (mainly at the bottom of the page, but basically wherever the client wants to insert said image/saying). The ...
0
votes
1answer
419 views
show all the posts thumbnails
I want to display all the posts by the featured image of each post.
Is there a shortcode or can you give me some tips on how to achieve this ?
Thanks!
1
vote
2answers
3k views
Include PHP file in Content using [shortcode]
Here is what I have
I am not having any lucking finding how to simply include a file in the content editor using a shortcode.
For Example if I wanted to include form.php inside my Contact Page how ...
0
votes
1answer
218 views
Gallery Shortcode Function Help
Okay, so I found this code online that allows you to add the option of how many thumbnails you want to show in the gallery shortcode.
The code below is what they say to add to the functions.php file
...
6
votes
2answers
8k views
How to manually fix the WordPress gallery code using PHP in functions.php?
It's been talked many times that Wordpress outputs some really bad code for the built-in gallery function.
This is the core code responsible for the gallery output (in /wp-includes/media.php):
...
0
votes
1answer
619 views
Use a shortcode to display custom meta box contents
Is this possible? If so, can someone point me towards a clear tutorial? I have a column of content I want to float right of the_content, so I'd like to be able to use a shortcode to put that content ...
0
votes
1answer
79 views
grab or load text on demand
What i want to do
I want some content (could be stored any where in a post or custom field) to load only when the user clicks for it to load. This content could be any thing (text,images,html etc) ...
0
votes
1answer
141 views
Add title & subtitle to shortcodes
Is there a way I can add a custom title & subtitle to this shortcode function?
function spoiler( $atts, $content = null ) {
return '<div class="moreinfo">
<h3 class="click drop ...
1
vote
2answers
317 views
Display gallery on top before content
Is it possible to execute the gallery shortcode before any other content no matter where the shortcode is in the post HTML?
2
votes
1answer
877 views
Solution to render Shortcodes in Admin Editor
I have asked this question about a year ago and I am hoping there is some type of simple solution which will allow me achieve my objective. So here it goes:
I often utilize shortcodes within the ...
0
votes
2answers
390 views
Echo custom field value in shortcode function
I must be doing something wrong here. I want to display the custom fields "pw_featured_note" & "pw_featured_price"
Here is my code so far
function featured() {
...
0
votes
1answer
1k views
How to add a shortcode to call a function
I'm using Cimy User Extra Fields to add more registration fields. I'm also using Contact Form 7 Dynamic Text Extension to pre-populate contact form fields.
I've read, in order to be able to use Cimy ...
0
votes
1answer
221 views
How can I call a PHP function inside a hardcoded shortcode?
Maybe I'm doing this the long way but I need to make something like this:
<?php echo do_shortcode('[mu-events months="11" startmonth="today" orderby="time" orderas="ASC" sites="?> <?php ...
1
vote
4answers
144 views
Snippets: is it better to add them in functions.php or make site-specific plugins?
Should "snippets" (short code or functions) be added to:
the theme's functions.php?
OR
make site-specific plugins?
Which is better from technical, security, performance, etc., standpoint?
...
1
vote
0answers
96 views
include a post unrendered into a post, then render the whole thing [closed]
With a few extra lines in my functions.php I've created a shortcode that lets me include the content of a post:
function include_content( $atts ) {
$id = (int) $atts['id'];
if ( ! $post = ...
0
votes
1answer
38 views
Shortcode Variations?
The function below creates a button when used like so [btn]Button Text[/btn]
function btn($atts, $content = null) {
extract(shortcode_atts(array('link' => '#'), $atts));
return '<a ...
0
votes
2answers
573 views
Shortcodes and Javascript/jQuery Function Calls [closed]
I'm learning about shortcodes and javascript.
I've simplified my problem as much as possible. In my shortcode's php file I wp_enqueue script1_javascript.js and script2_jquery.js. The first script is ...
-1
votes
1answer
317 views
IMG inserting shortcode function [closed]
I want to have such feature that when users post in the comment link to the image (jpg, png etc) in would have [img][/img] around it and have rel="fancybox"to open it in the modal window.
A have such ...
0
votes
1answer
298 views
Help with Wordpress function inside a shortcode
I'm trying to spice up a theme of mine with some shortcode buttons but I'm having quite a bit of trouble when trying to call the author's name within the button itself. I tried simply including
...
0
votes
2answers
361 views
Echoing function into Wordpress NextGen gallery
Is there anyway to echo a function into a wordpress shortcode?
heres my code:
<div id="subscription">
<?php echo do_shortcode('[nggallery id=$ID]');?>
</div>
$ID is a function ...
1
vote
1answer
290 views
May i Use ShortCode in Template?
Am Using Wordpress Blog.Here i want Use Tweetmeme Plugin.I want to show the output of the Tweetmeme Plugin to Customizing place(Side of the Post[Not Before or After]).The Plugin Creators are providing ...
1
vote
1answer
479 views
Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
The following code is supposed to allow for a shortcode that includes many attributes, but not all of the attributes may always be present in which case I do not want the containing element to show ...
2
votes
3answers
1k views
Creating a table from shortcode avoiding wpautop for each row
I'm probably doing this all wrong, and there'll be a much simpler solution. Basically, I'm trying to build a table of tour dates that'll be editable by someone with little technical knowledge, but can ...
2
votes
2answers
170 views
Post the content of a specific “Custom Post Type” post within a post using a shortcode
The posts on our music blog usually include multiple tracks of music.
I want to have each individual track be its own entity--a custom post type called "track"--which I want to be able to insert ...
1
vote
5answers
2k views
Display post shortcode content in the sidebar?
I need to display images and other content in the sidebar depending on a page. Pages are added dynamically and information that need to appear in the sidebar is different for each page. So I can't ...
0
votes
1answer
520 views
Shortcode content filter?
I'm looking for something, but don't exactly know what.
I have a shortcode, let's call it [shortcode].
Users will input HTML tags inside, mostly images, but also links, images in links, etc., for ...
0
votes
1answer
1k views
Problem with shortcode inside a shortcode
I use this in my Functions.php file to format short codes for some jQuery UI tabs, however I also use a short tag to reference my video embeds, which breaks when they're inside the UI tabs.
My ...
3
votes
3answers
2k views
Add new “Insert Into Post” button with another function
Problem: Add a hook that automatically adds a short tag to video attachments
when inserted from the Media Library (video) tab:
Update:
This works under the 'Media Library' tab — and doesn't break ...