XML-code sent via the POST method to the URL (API) [closed]
XML-code sent via the POST method to the URL (API) [closed]
XML-code sent via the POST method to the URL (API) [closed]
Try this alternative way of getting the post objects. Seeing as your loop seems to be using the global post data anyway, this method uses setup_postdata to set the global values. $post_objects = get_field(‘post_objects’); if( $post_objects ): ?> <ul> <?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?> <?php setup_postdata($post); ?> … Read more
Check out if you have proper user roles set for your user account in each site. To do so, open wp-admin/network, open Sites, and when you click Edit for each site, you can see users assigned and roles. There you can add your user to sites.
If you can access the ID of your post, it means that the query has already been run. So, in this case, you can’t use pre_get_posts anymore. A solution would be to wrap your code in a conditional, and then use functions such as get_the_permalink() or get_the_title() which accept a post ID, to get the … Read more
$term isn’t being set anywhere in your code. You’re putting IDs into $terms_ids, but then in your query you’re using $term->term_id. $term doesn’t exist outside of the foreach. You need to be passing $terms_ids directly into terms: $terms = get_the_terms( get_the_ID(), ‘kosmetyki_dystrybutor’); $terms_ids = []; foreach ( $terms as $term ) { $terms_ids[] = $term->term_id; … Read more
In your theme’s functions file, use the body_class filter to add new classes: function wpse_282694_body_class( $classes ) { if ( is_home() ) { $classes[] = ‘blog’; } return $classes; } add_filter( ‘body_class’, ‘wpse_282694_body_class’ ); If your category archives, tag archives, date archives and search results also need the same styling, which is fairly commin, check … Read more
You’re using get_the_date() wrong. That function gets the date of the post in a given format, and the 2nd argument is the Post ID for the post to get the date for. Not a time. The simplest way to do this would be to just use timestamps. So you can just get the post date … Read more
With the help of someone else, I managed to figure this out. Add this to your functions.php: // Scheduled posts should update modified date when published function update_modified_date_to_post_date( $post ) { $updated_data = [ ‘ID’ => $post->ID, ‘post_modified’ => $post->post_date, ‘post_modified_gmt’ => $post->post_date_gmt ]; wp_update_post( $updated_data ); } add_action( ‘future_to_publish’, ‘update_modified_date_to_post_date’, 10, 1 );
More then one menu items are assigned with “current-menu-item” class
Well, for whoever went under the same question, I found the solution: I’ve changed the filter and looks like this now: add_filter( ‘posts_where’, ‘general_filter’, 10, 2 ); $posts = new WP_Query($args); remove_filter( ‘posts_where’, ‘general_filter’, 10, 2 ); and the function… function general_filter( $where, &$wp_query ) { global $wpdb; if ( $search_term = $wp_query->get( ‘search_prod_title’ ) … Read more