Multiple level category drop-down

function parent_child_cat_select() { ?> <script type=”text/javascript”> /* <![CDATA[ */ jQuery(document).ready(function() { jQuery(‘#parent_cat’).change(function(){ var parentCat=jQuery(‘#parent_cat’).val(); // call ajax jQuery.ajax({ url:”/wp-admin/admin-ajax.php”, type:’POST’, data:’action=category_select_action&parent_cat_ID=’ + parentCat, success:function(results) { jQuery(“#sub_cat_div”).html(results); } }); }); }); /* ]]> */ </script> <form action=”<?php bloginfo(‘url’); ?>/” method=”get”> <div id=”parent_cat_div”><?php wp_dropdown_categories(“show_option_none=Select parent category&orderby=name&depth=1&hierarchical=1&id=parent_cat”); ?></div> <div id=”sub_cat_div”><select name=”sub_cat_disabled” id=”sub_cat_disabled” disabled=”disabled”><option>Select parent category first!</option></select></div> <div id=”submit_div”><input … Read more

Is it mandatory to have a link to the theme designer?

It depends on the license under which the Theme is released. Assuming the Theme was released under GPL: no; you are free to change the Theme in any way you want. If you redistribute the Theme, modified or unmodified, you are required to maintain the original copyright/license information in the Theme file headers, but are … Read more

Grab the first paragraph of each post

You can use this function: function get_first_paragraph(){ global $post; $str = wpautop( get_the_content() ); $str = substr( $str, 0, strpos( $str, ‘</p>’ ) + 4 ); $str = strip_tags($str, ‘<a><strong><em>’); return ‘<p>’ . $str . ‘</p>’; } and then call it in your loop with: <?php echo get_first_paragraph(); ?> The magic part your looking for … Read more

What is the first file wordpress looks at in a theme?

If it’s the home page, WordPress will look for the following files in this order and use the first one it finds: 1. front-page.php 2. home.php 3. index.php WordPress template hierarchy is described in detail here: https://developer.wordpress.org/themes/basics/template-hierarchy/ This article explains how WordPress determines which template file(s) to use on individual pages. If you want to … Read more

How get list of updates of wp site?

When on the admin view you can use the following functions to get update data. get_plugin_updates() get_theme_updates() get_core_updates() If you want to build your own functions, then you can get update related data from site transients update_themes, update_plugins, and update_core. Then you can compare the plugin and theme transients with the theme and plugin arrays … Read more

How to get Ajax into a theme – without writing a plugin?

Put those add_action functions in your functions.php file too. If they’re in header.php, WordPress never registers them since header isn’t loaded in AJAX. Also, you don’t need that is_admin() check. The theme’s header will never load in admin. So, your functions file should look like this: add_action(‘wp_ajax_my_special_action’, ‘my_action_callback’); add_action(‘wp_ajax_nopriv_my_special_action’, ‘my_action_callback’); function my_action_callback() { $whatever = … Read more