Tag Info

New answers tagged

0

Looking though the existing plugins, the standard tinymce way to do this is to save the popup window in a win variable: { text: 'Vídeos', onclick: function() { var win = editor.windowManager.open({ //etc And then use win.find('#name') to target the control, eg: {type: 'listbox', name: 'video_site', onselect: function( ) ...


2

Here is how you should create shortcode. First you will have to define $atts item in get_userdata because $atts is an array. Also I think there is also some issues with uppercase attributes names, so you should use attribute in lower case. So instead of userID, use userid. function getUserEmail_func( $atts ) { $user_info = get_userdata( $atts['userid'] ...


0

Wordpress has this little minimally documented function, wp_video_shortcode() Just pass an array with the necessary information as if you were writing out the shortcode.


0

You should give the Attributes Section of the Shortcode API WordPress Codex page a read. Unquoted values also must never contain spaces. Short summary, use quotes - either " or ' - for attribute values with a space in it. Because an attribute name isn't actually needed I think the »Info« part of your name will be an extra part of your $atts array, ...


1

Your solution has helped me find an answer to my own problem of getting the attribute of a certain shortcode, but I fear there may be an issue with your approach. You're using preg_match to check the post_content, which will only return 1 match. If you have a post that has multiple shortcodes in it, it will only return the first one, which may not be the ...


0

Specific Events Manager template tags are another way to achieve this, for example: <?php echo EM_Events::output(array('scope'=>'tomorrow', 'limit'=>10, )); ?> You can use any of the attributes. (http://wp-events-plugin.com/documentation/event-search-attributes/) One of the attributes is, 'format', which formats the output and lets you use ...


2

Method #1 If available, I would use the: shortcode_atts_{$shortcode} filter to collect the attributes of a given shortcode. Example: $text = ' [gallery] [gallery ids="1,2" link="file"] [gallery ids="3"] [caption id="attachment_6" align="alignright" width="300"] '; if( class_exists( 'WPSE_CollectShortcodeAttributes' ) ) { $o = new ...


0

This is pretty much what Foxsk8 mentioned in a comment, so credit should go to him, but these additional instructions will be useful. The WordPress plugin called TinyMCE Advanced will solve your problem. This plugin comes with an option inside Settings > TinyMCE Advanced that will fix your disappearing <p> tags. Mark the checkbox labeled Stop ...


0

I ended up writing a basic function which used preg_match_all and preg_replace to find my short-code tags and sanitize the content before building the HTML output for the template page. In my case, only useful if you have the one short tag being used. function img_strip($str) { $preg = '/\[\bimg\b\](.*?)\[\/\bimg\b\]/'; preg_match_all($preg, ...


0

You can use the do_shortcode() function for this. echo do_shortcode( '[your-shortcode including="any" parameters="needed"]' );


0

If you want to put PHP code in the editor you need a plugin, same goes for display-posts. Display Posts shortcode isn't a built in function. https://wordpress.org/plugins/display-posts-shortcode/


-1

Try this <?php echo do_shortcode('[display-posts id="1305"]'); ?>


0

why not set white-space : normal ? https://developer.mozilla.org/en-US/docs/Web/CSS/white-space without seeing the rest of your css, its hard to determine why the text isn't wrapping naturally


0

The correct way is not to do it. Shortcodes are supposed to be self contained and represent an insertion point to some complicated HTML that is harder to get right or due to security permissions is impossible to insert in its pure HTML form. Globals are hated magic when you write proper code, now think about plain text, how exactly the non technical writer ...


2

You should use do_shortcode() function in both strings you are returning it will execute the shortcodes in the string. function oldStuff(){ return do_shortcode(' [new] only raw html is in this function '); } add_shortcode('old', 'oldStuff');


0

I have found the culprit: I was using the recommended way to do ajax in wordpress, using admin-ajax.php. Turns out it is best used for wp-admin related actions, not so much for frontend use cases. To bypass this, i created my own ajax handling file, mimicking the code found in admin-ajax.php. IF you need it, you can find it as a Gist.


0

It depends on how you want the pdfs added but this should probably be a cover all: function embed_pdf_files( $atts, $content = null ){ //add default attributes here. $defaults = array( //'width' => '100%', //'height' => '1000' ); //This overwrites defaults with the attributes in shortcode $a = shortcode_atts( ...


0

Try passing the content of each shortcode through apply_filters( 'the_content', $content ); - you may not be getting your shortcode output because it's never being called in the first place (beyond the top level). the_content filter include do_shortcode() (from memory), which is what you need. See how it goes...


0

Thanks to the response by @bueltge : Added extra line in the __construct() function: public function __construct() { $this->var = $this->shortcode_1(); //added add_shortcode( 'the_single', array( $this, 'shortcode_2' )); }


4

Caption shortcode attributes are merged with defaults using shortcode_atts function like so (see source in media.php): $atts = shortcode_atts( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '', 'class' => '', ), $attr, 'caption' ); So the 3rd $shortcode param is in use with the value of 'caption'. As ...


0

Issue solved: I had to do_shortcode to post_content.


0

I would suggest this, which moves specific 'block-level' shortcodes outside of 'p' elements without affecting those elsewhere that may be intended to be inline: function my_fix_shortcodes($content){ if (strpos($content, '<p>') !== false) { /* Move 'block level' shortcode tags outside <p> elements by surrounding with ...


1

You have a couple of flaws in your code get_post_meta( 'fap_referral_link' ) should be get_post_meta( $post->ID, 'fap_referral_link', true ). Please see get_post_meta() You should always first check if you actually have posts before you run your foreach loop Never ever use extract(). It uses eval() which stand for EVIL. This has been completely removed ...


0

Thank you @bueltge for the answer! I was focusing on the shortcode and didn't even think to call the function in the 'normal' way. echo dynamicContent() worked.


0

Ok, so somehow I got it working by changing it to this: It looks like it didn't like 'the_clientId'. Maybe it just doesn't like capital letters???? [insert-form form_location="form.php" identification_number="12345"] function insert_the_form($atts){ $form_base = plugin_dir_path(__DIR__); // Shortcode attributes & options $atts = shortcode_atts( ...


-2

Using SESSION, storing $clientId to SESSION and calling it back in FORM


0

This is an old question, but I needed the answer to this one as well. Here is the solution taken right from the WP codex... $prev = '<div class="nav-previous">' . get_next_posts_link( __( '<span class="meta-nav">&larr;</span> Previous' ), $loop->max_num_pages ); You need to append the max_num_pages parameter from the query to your ...


0

Beside the fact that your code could be better, here is a simple solution. Using output buffers will write everything to a variable. <?php ob_start(); ?> <form id="new_post" name="new_post" method="post" action="" class="submit-form" enctype="multipart/form-data"> <fieldset class="tax"> <label for="class">Class ...


1

You can use do_shortcode() echo do_shortcode($post_customs["project_items_".$i."_edit_proposal_item"][0]); More : http://codex.wordpress.org/Function_Reference/do_shortcode


-2

Go to "Pages" and find the page with the ID. Open it in editor. On the right hand side, look for "page attributes". You can add php files here. All you have to do is, create a PHP page under your theme, and add this to your beginning of the file: <?php /* Template Name: A PAGE NAME HERE */ Reload, and your file shows up with the A PAGE NAME HERE ...



Top 50 recent answers are included