How can I add an area/option for a custom page description?

A simple, easy, and quick way to add your own custom meta box to your Pages is by first installing the Meta Boxes plugin (required). Next, add the following custom code to your functions.php in your child theme: add_filter( ‘rwmb_meta_boxes’, ‘wpse_236870_meta_boxes’ ); function wpse_236870_meta_boxes( $meta_boxes ) { // Add custom meta box in ‘Pages’ $meta_boxes[] … Read more

Let Users Choose Post Categories

First, you will have to add the categories to user profiles. This question has been addressed before. That will give you the possibility to retrieve an array $data with the category ID’ a user is interested in. Now, you will need to turn that array into a list of posts. Depending on where you want … Read more

Counter in loop in foreach

EDIT Ok so after better understanding your issue, I would not use a counter but a true/false flag that we switch when it’s been used. Try this code. $cats = array(‘batiments-delevage’, ‘logements-bovin’, ‘stockages-deffluents’, ‘soins-et-hygiene’); $exclude_posts = array(); $active = true; foreach( $cats as $cat ) : // build query argument $query_args = array( ‘category_name’ => … Read more

Limit 1 global comment per minute

Place the following into a custom plugin or into your child theme’s functions file: add_action(“wp_insert_comment”, function() { global $current_user; if ( !$current_user->ID ) return; update_user_meta( $current_user->ID, “se_last_commented”, time() ); }); add_action(“init”, function() { if ( “wp-comments-post.php” == $GLOBALS[‘pagenow’] ) { global $current_user; if ( !$current_user->ID ) return; $last_commented = (int) get_user_meta( $current_user->ID, “se_last_commented”, 1 ); … Read more