Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
5
votes
Accepted
Dynamically create shortcodes using add_shortcode and a callback
$atts = shortcode_atts( array(
'name' => 'john',
'type' => 'mammal'
), $atts);
// shortcode data
$shortcodes = apply_filters("shortcode_list", array());
$shortcode = $ … .= $shortcode['html'];
//$markup .= do_shortcode($shortcode['html']); // to replace shortcodes in the "html" data
$markup .= '<pre>';
$markup .= print_r($atts, TRUE …
0
votes
Add_shortcode as a Class to pass arguments to a function
If you cannot modify the method exe_short, you can create a new method like that
class MyLittleClass {
public static function exe_short2($attr, $content, $tag) {
$atts = $attr;
…
0
votes
Accepted
Add_shortcode as a Class to pass arguments to a function
To create multiple shortcodes, you can get the default values from a static attribut of the class.
This code create 2 shortcodes myshortcode1 and myshortcode2. In the included files, you can read vari …
1
vote
Accepted
How does one insert a variable value into a "myCRED plugin shortcode
You can create the shortcode as a string like this :
$rate = 2587.36;
$code = "[mycred_exchange from=\"mycred_default\" to=\"mycred_usd\" min=\"0.00001\" rate=\"$rate\"]";
and then, to execute the …
4
votes
Accepted
change plugin shortcode function
you can override the shortcode like this :
add_action("init", function () {
remove_shortcode("timelinr");
add_shortcode("timelinr", function ($atts, $content) {
// call the shortcode … wp_enqueue_style("timelinr-style2", "new.css");
// result of the shortcode
return $result;
});
}); …
1
vote
Change post type depending on shortcode
the callback function has 3 parameters and the 3rd is the tag name :
add_shortcode( 'all_faq', 'commonFunction' );
add_shortcode( 'wordpress_faq', 'commonFunction' );
function commonFunction($attr …
1
vote
Accepted
Display random text from a file with the WP built-in AJAX API
to have the good path to the file, try this :
$array = file(plugin_dir_path(__FILE__) . "quotes.txt");
1
vote
Getting error on submitting form using Ajax with shortcode
the 2 "add_action ajax ..." are executed only when the shortcode is executed.
and then, ob_get_clean was not a the good place
in order to work, theses actions need to be separated of the shortcode like …
1
vote
Automatically populating a date parameter within a shortcode
isset($atts["id_form"])) {
return "shortcode $tag : the argument id_form is missing. … .= "]";
}
return do_shortcode($shortcodes);
});
with this new shortcode, you can for example use
[MY_PLUGIN__forms_with_dates id_form=862 months=3]
and the result will …