How do I write this SQL statement for Posts written in last 24 hours?
Personally, I’d generate the date in php using the PHP Date class and then $date->sub(). With a few more lines of code the query will read: … WHERE post_date >= “.$date.” …
Personally, I’d generate the date in php using the PHP Date class and then $date->sub(). With a few more lines of code the query will read: … WHERE post_date >= “.$date.” …
I have build, some time before a widget, Also you can set the number of posts, the category and the order! <?php /****** Widget ******/ class Artdev_Category_Posts extends WP_Widget { function Artdev_Category_Posts() { $widget_ops = array(‘description’ => ‘Add Selected Category Posts to the Sidebar’ ); parent::WP_Widget(false, __(‘→ Category List’, ‘artdev’),$widget_ops); } function widget($args, $instance) { … Read more
I’m unable to comment on this SX but I would have thought the best way to do what you wanted would have been to use a custom post type, but combine it with a custom taxonomy. In the same way that a post belongs to a category, a fish species could belong to a genus … Read more
Ok so after posting the question an option to view another similar question appeared. So here is the answer if somebody is trying to do the same thing. //Using WordPress Pre-Get filter to order the custom taxonomy by custom field function customize_customtaxonomy_archive_display ( $query ) { if (($query->is_main_query()) && (is_tax(‘custom-taxonomy’))) $query->set( ‘post_type’, ‘your-post-type’ ); $query->set( … Read more
As I have stated in comments, this will take some work. In short, you will need the following: Get all the terms from the style taxonomy. Here we would only want the term ids Get the current tax_query from the colour taxonomy. Use each term from the style taxonomy and create a new tax_query to … Read more
I finally found the answer myself. It’s two parts: I need the global $switched to be defined. The variable for blog id can’t be $blog_id because that’s reserved. The above code should thus be the following. require_once( “../wp-load.php” ); global $switched; $blog_id_target = 2; switch_to_blog($blog_id_target); $lang = ‘en’; $new_pr = wp_insert_post( array( ‘post_author’ => 1, … Read more
There are several user access plugins available, including one called Members. The settings panel for the Members plugin is in Settings >> Members Components. From there you can enable what you want. To edit roles you have to enable the Edit Roles component, then go to Users >> Roles. Click on the role you want … Read more
If I follow your question correctly you could use a nested query loop, that is looping through your taxonomy terms and then doing a WP_Query loop for each one. There is a more complicated approach using custom SQL and a filter but the following example is what I would go for: $terms = get_terms(“locations”); $count … Read more
I’ve fixed this issue by adding the below code: add_rewrite_rule(‘our-team/developers/?$’,’index.php?pagename=our-team/developers’, ‘top’); add_rewrite_rule(‘our-team/support-staff/?$’,’index.php?pagename=our-team/support-staff’, ‘top’);
So, I was researching this topic a bit deeper. All answers found on this SE suggested disabling Gutenberg with a plugin. This couldn’t be a valid “fix” in my oppinion. After researching and browsing through the git issues of WordPress/gutenberg I’ve found a pretty easy solution for this problem. The user joshuafredrickson on the git … Read more