Order Categories by Character Count

This is probably more a question about PHP rather than WordPress, and as such may be closed as off-topic for this site. That said, you can usort() to sort an array using a custom comparison function: usort( $listings->loop[‘cats’], function( $a, $b ){ return strlen( $a->name ) – strlen( $b->name ); } ); After the call … Read more

Custom Wp_query loop takes very long

I found a solution to my question. I used the following code: global $wpdb; if($t_query->have_posts()){ while($t_query->have_posts()){ $t_query->the_post(); echo $wpdb->last_query.”\r\n”; } } and it showed there was an action somewhere hooked to the_post hook, sending requests to update some meta every time a post was processed. So, the answer to my question is: I should have … Read more

Prevent duplicating specific column from database table

This is more of a general PHP question than a WordPress one. Use an array with the county as a key to group up your results. $groups = array(); foreach( $results as $result ) { $groups[$result->county][] = $result; } var_dump or print_r on $groups to see how this groups up your results. You can then … Read more

What template file is used by default for posts?

You can create new template php file. //Template Name : Single Page Template get_header(); if ( have_posts() ) : while ( have_posts() ) : the_post(); the_content(); the_permalink();//this is for the <a> bunch you are looking for endwhile; endif; get_footer(); Here , you can use “//” or “/** **/” to set the Template name , it … Read more

Static posts page is not working

When you use “static front page” are you selecting the actual page you want displayed on the home page? It sounds like you want the “Splash” page as the home page. You should create the Splash page in the Page Edit Screen, select a custom page template if that is what you’re wanting to use … Read more

$_html is empty when var dumped

so I turn to you guys to help me see what I am doing wrong here. First thing your doing wrong is over complicating a simple effective API. Your code makes no sense. Your mixing functions that echo output with arbitrary html mark up that gets assigned to a non existing class property that nothing … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)