Complex Slider Shortcode Help
Complex Slider Shortcode Help
Complex Slider Shortcode Help
If anybody is interested: I managed it to add a data attribute to the article thumbnail with following filter: function post_thumbnail_add_data_attribute( $input, $post_image_id ) { $caption = wptexturize(get_post(get_post_thumbnail_id())->post_excerpt); $substitute = is_home() ? “<img” : “<img data-description=\”” . $caption . “\””; return str_replace(“<img”, $substitute, $input); } add_filter(‘post_thumbnail_html’, ‘post_thumbnail_add_data_attribute’, 10, 3 ); For the gallery I followed … Read more
I realise that you say that you can’t enable paging of users, but if it’s a case of you don’t know how, you can pass ‘number’ and ‘offset’ in the args array. In your example to get page 2 of your users, set ‘number’ as ‘5’ and ‘offset’ as ‘5’. If using those variables is … Read more
Adding shortcode field to edit gallery / Gallery Settings
Ok, for some reason it’s now working. Instead of hooking into ‘init’ I’ve used ‘the_post’ and the form shortcode does it’s job. I no longer have an issue with publishing a new post or the data not saving. Also, no “Cannot modify header information – headers already sent” error. The function function el_process_form(){ if( $_SERVER[‘REQUEST_METHOD’] … Read more
To fetch users with certain meta field, you can use WP_User_Query class. Check codex manual for it. So you can create a custom shortcode like this: add_shortcode( ‘listusers’, ‘wpse8170_listusers’ ); function wpse8170_listusers( $atts, $content=”” ) { $atts = shortcode_atts( array( ‘company’ => false ), $atts ); if ( empty( $atts[‘company’] ) ) return $content; $query … Read more
function get_page_func( $atts ){ extract(shortcode_atts( array( ‘title’ => ” ), $atts ) ); $page = get_page_by_title($title); $args = array( ‘include’ => $page->ID, ); $pages = get_pages($args); $html = $pages[0]->post_content; $html = do_shortcode($html); return $html; } add_shortcode( ‘get_page’, ‘get_page_func’ ); Use above code. Wherever you require shortcode to be executed just use the following line echo … Read more
You can try to re-register the default WordPress shortcode: /** * Re-Register the default shortcode * WPSE: 120057 */ function wpse_120057() { add_shortcode( ‘video’, ‘wp_video_shortcode’ ); } add_action( ‘plugins_loaded’, ‘wpse_120057’ ); Here is the file in the Shortcodes Ultimate plugin that contains the shortcode registration.
How to protect parts of my code from TinyMCE modification when switching from text to visual mode?
Based on my own experience, I’ve used a combination of method 1 & 2 – the architecture and footer scripts of 1, and the ‘look-ahead’ technique of 2. For the look-ahead though, I use regex in place of stripos; personal preference, faster, and can check for ‘malformed’ shortcode; preg_match( ‘#\[ *shortcode([^\]])*\]#i’, $content ); If you’re … Read more