Edit category output

You will need to use style parameter to define the type of list. And to remove <br /> tags from the list, set parameter ‘echo’ => 0 and str_replace to remove <br /> tag from the output. $args = array( ‘orderby’ => ‘name’, ‘show_count’ => 0, ‘pad_counts’ => 0, ‘hierarchical’ => 1, ‘taxonomy’ => $tax, … Read more

Widgets not showing in my custom theme

You’re using the widget name and not i.d which is why it isn’t working. Change this: if (is_active_sidebar( ‘My_Widgtet_Area’ ) ) : ?> <div id=”widget-sidebar”> <ul> <?php dynamic_sidebar( ‘My_Widgtet_Area’ ); ?> </ul> To this: if (is_active_sidebar( ‘partner-slide’ ) ) : ?> <div id=”widget-sidebar”> <ul> <?php dynamic_sidebar( ‘partner-slide’ ); ?> </ul> The i.d in the template … Read more

Remove all nav menu classes ( but keep useful ones… )

You could work with a white-list and replace the regular expression with something more readable: add_filter( ‘nav_menu_css_class’, function( $classes ) { $allowed = [ ‘menu-item-has-children’, ‘current-menu-item’ ]; return array_intersect( $classes, $allowed ); }); That would make it easier to maintain the white-list too.

File upload, uploads only file name

The WordPress codex states that “The file MUST be on the uploads directory”. I’ve added a line to move the uploaded file into the uploads directory and changed the guid path. if( isset( $_POST[‘submit’] ) ) { $filename = $_FILES[‘file’][‘name’]; $wp_filetype = wp_check_filetype( basename($filename), null ); $wp_upload_dir = wp_upload_dir(); // Move the uploaded file into … Read more

there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?

The no no about loading wp-* files directly are reasonable when you are developing a WordPress plugin or theme, but if you are developing an external code that require WP (and that seems your case) than you must require that files, there is no alternatives. Consider that including wp-blog-header.php is needed when you need to … Read more

WordPress Ajax Data problem

$.post(ajaxurl,{ action:’master_ajaxurl’, option: $(this).find(“option:selected”).val(), // use option also here }, function(data){ //adds the echoed response to our container // alert(data); $(“#details”).html(data); } ); Move action and functions into function.php file make some changes as commented add_action(‘wp_ajax_master_ajaxurl’, ‘master_ajaxurl’); add_action(‘wp_ajax_nopriv_master_ajaxurl’, ‘master_ajaxurl’); function master_ajaxurl() { $myOpt = $_POST[‘option’]; // use option instead of data echo bringDetails($myOpt); die(); } … Read more