Using tabs in admin widgets [closed]

The problem is that you’re not using unique IDs (#tabs, #tabs-1 …), because widgets have multiple instances (the same IDs are used by the instance form the “Available Widgets” area). So just prepend or append the widget instance ID to your identifiers to make them unique: … <div id=”tabs-<?php echo $this->id; ?>”> <ul> <li><a href=”#tabs-<?php … Read more

Don’t display html if custom field is empty

I have no experience with WP UI, but the following code might do the trick: <!– Videos Tab –> <h3 class=”wp-tab-title”>Videos</h3> <?php if (get_field(‘videos’) && get_field(‘videos’) != “”) { ?> <div class=”wp-tab-content”> <?php the_field(‘videos’); ?> </div><!– Close Videos –> <?php } ?>

Create Post tabs in single-{content-type}.php with Custom Field values

You can use rewrite endpoints to achieve this. First, register your endpoints: function wpa_movie_endpoints() { add_rewrite_endpoint( ‘synopsis’, EP_PERMALINK ); add_rewrite_endpoint( ‘screens’, EP_PERMALINK ); add_rewrite_endpoint( ‘trailer’, EP_PERMALINK ); } add_action( ‘init’, ‘wpa_movie_endpoints’ ); So now in addition to http://domain.com/post-name/ (or whatever your particular permalink structure is), you’ll have: http://domain.com/post-name/synopsis/ http://domain.com/post-name/screens/ http://domain.com/post-name/trailer/ You can then check for … Read more

Rename Buddypress Profile Tab

Look at the source, you know that already. 🙂 I didn’t but I bet there is a piece of code looking like this: _e( ‘Activity’, ‘buddypress’ ); … or … __( ‘Activity’, ‘buddypress’ ); Follow the functions, they are wrappers for the function translate() in wp-includes/l10n.php: /** * Retrieves the translation of $text. If there … Read more

How can I run shortcode after click with ajax

You should try to replace the following jQuery part: action: ‘process_shortcode_on_tab_click’ with this one: action: ‘process_shortcode_on_tab_click_action’ to match your wp_ajax_process_shortcode_on_tab_click_action and wp_ajax_nopriv_process_shortcode_on_tab_click_action actions. Check for example the Codex on how to name the custom wp_ajax_$youraction hook.

custom tabs in media uploader

found it. in the automattic SVN for media.php i found the media_upload_header() function, and the only thing left to do is to echo it in the last function: function media_upload_ell_gmap_form() { echo media_upload_header(); ?> <h2>HTML Form</h2> <?php } that’s it.

Remove tabs from media uploader for a CPT

You can use the media_upload_tabs filter check for your post type and unset any tab you don’t want ex: function remove_media_library_tab($tabs) { if (isset($_REQUEST[‘post_id’])) { $post_type = get_post_type($_REQUEST[‘post_id’]); if (‘premium’ == $post_type) unset($tabs[‘library’]); unset($tabs[‘type_url’]); } return $tabs; } add_filter(‘media_upload_tabs’, ‘remove_media_library_tab’);

Switch to the library tab in the media uploader

After struggling around for days through the poorly documented media modal source code and using code from the gist (thanks, Fabien), I came up with a solution: JS: wp.media.controller.Custom = wp.media.controller.State.extend({ initialize: function(){ this.props = new Backbone.Model({ custom_data: ” }); this.props.on( ‘change:custom_data’, this.refresh, this ); }, refresh: function() { this.frame.toolbar.get().refresh(); }, // called when the … Read more

How do I change tab size in Vim?

Expanding on zoul’s answer: If you want to setup Vim to use specific settings when editing a particular filetype, you’ll want to use autocommands: This will make it so that tabs are displayed as 4 spaces. Setting expandtab will cause Vim to actually insert spaces (the number of them being controlled by tabstop) when you press tab; you … Read more