Hide input field when second input field is in focus

This question is out of scope here. You should try stackoverflow for this question. Though I would like to answer your question. You need to use some CSS as well as JQuery for getting the desired result. See the working fiddle here. Hope this works for you. CSS addition: input[type=subscribe]:focus + input[type=search] { display:none; } … Read more

check if a draft has been moved there from publish to draft

As far as I can see, you won’t get any indication a post was previously published, as wordpress remembers only the old versus new transitions. I recommend you add some meta data, that is use add_action(‘publish_post’, ‘your_function’) (or similar) to do update_post_meta($post->ID, ‘post_published’, ‘on’). That way, every post gets an indicator when it’s published – … Read more

How to include css for plugin setting page? [duplicate]

Refer documentation Link Scripts Only on a Plugin Administration Screen add_action( ‘admin_menu’, ‘my_plugin_admin_menu’ ); function my_plugin_admin_menu() { /* Add our plugin submenu and administration screen */ $page_hook_suffix = add_submenu_page( ‘edit.php’, // The parent page of this submenu __( ‘My Plugin’, ‘myPlugin’ ), // The submenu title __( ‘My Plugin’, ‘myPlugin’ ), // The screen title … Read more

Sidebar Categories change arrow when subcategories are shown on click

I added these lines: $(this).removeClass(‘ic-arrdn’).addClass(‘ic-arrup’); $(this).removeClass(‘ic-arrdn’).addClass(‘ic-arrup’); and achieved the result. $(document).ready(function () { $(“aside ul li:has(ul)”).addClass(“ic-arrdn”); var e = $(“aside > ul > li.current-cat, aside > ul > li.current-cat-parent”); if (e.length == 1) { } $(“aside > ul > li > ul.children”).each(function () { $(this).find(“li”) $(this).parent().toggle(function () { $(this).find(“ul”).slideDown(); $(this).removeClass(‘ic-arrdn’).addClass(‘ic-arrup’); }, function () { $(this).find(“ul”).slideUp(); … Read more

Custom Taxonomy + JQuery Tabs

This should work, but it’s not tested <div id=”tabs”> <ul id=”tab-menu”> <?php $terms = get_terms(‘category’); global $wpdb; $posts = array(); if ( is_array($terms) && ! empty($terms) ) { $active = null; foreach ( $terms as $i => $term ) { $ids = $wpdb->get_col( $wpdb->prepare(“SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d”, $term->term_taxonomy_id )); $articles_count = … Read more

How do I remove certain HTML elements with specific classes from the feed?

Use the filter the_content_feed. He is explizit for change content, before sending in feed. A small example. Include a regex or replacement function to get your goal on content. add_filter( “the_content_feed”, “fb_example_change_content_feed” ); function fb_example_change_content_feed( $content ) { $content .= ‘Total ‘ . str_word_count( $content ) . ‘ words’; return $content; }

how to load a file from a plugin when a url is passed

I ended up answering my own question by using the following code add_filter( ‘template_include’,’include_filter_template_function’, 1 ); function include_filter_template_function($template_path ) { $template_path = plugin_dir_path( __FILE__ ) .’filter.php’; return $template_path; } and checking the params on that page. I’m sure there is a more elegant way to do this but it works for me. 🙂

How to edit wordpress native gallery’s css file?

If you want to override the default gallery CSS, first, unhook the core-defined CSS: add_filter( ‘use_default_gallery_style’, ‘__return_false’ ); Then, you can add your own CSS, however you wish – using your Theme style.css, or via separate CSS file that you enqueue, etc.