Order pages by date

Try to use below filter in your theme file. function orderby_date( $orderby, $query ) { global $wpdb; return str_replace( “{$wpdb->posts}.post_date”, “CAST({$wpdb->posts}.post_date AS DATE)”, $orderby ); } add_filter( ‘posts_orderby’, ‘orderby_date’, 10, 2 );

What method would I use to show an image in between X amount of posts on category archive? [duplicate]

If you can update your theme files, just update category.php and archive.php this way: <?php $counter = 0; while ($the_query->have_posts()) : $the_query->the_post(); ?> <?php if ($counter % 4 == 0) : ?> <div class=”my-ad”>my ad</div> <?php endif; ?> <div class=”post”> <?php the_title(); ?> </div> <?php $counter++; endwhile; You can also change archive/category template by your … Read more

how to find the way they hacked my WP site

There are many things that I do to check a possible hack on the site. Changing FTP users/passwords, reinstalling WP, reinstalling themes/plugins, changing user account passwords (especially admin level), change hosting credentials. I wrote an entry on my own site to remind me (most of the stuff there is my own ‘notes’ to myself). May … Read more

How can I save a setting field with multiple checkbox options generated by a foreach loop on a custom wordpress admin page?

You can use the function xprofile_get_field_data( $field, $user_id, $multi_format) * @param mixed $field The ID of the field, or the $name of the field. * @param int $user_id The ID of the user. * @param string $multi_format How should array data be returned? ‘comma’ if you want a * comma-separated string; ‘array’ if you want … Read more

Fatal error: Call to undefined function wp_raise_memory_limit()

I think you first need to verify whether a plugin or theme is causing the problem. Temporarily rename the wp-content/plugins folder to something else, then access the admin panel. If the problem does not reoccur, recreate the wp-content/plugins folder, then move plugins’ folders in there in small groups to determine a suspect. You may need … Read more

Adding a third custom taxonomies

For every taxonomy you have to choose a unique name, which is used in the database. so so your new e.g. players_region. <?php add_action( ‘init’, ‘build_taxonomies’ ); function build_taxonomies() { register_taxonomy( ‘players_team’, // Unique name. ‘player’, // Post type. array( ‘hierarchical’ => true, ‘label’ => ‘Players Team’, ‘query_var’ => true, ‘rewrite’ => true, ) ); … Read more