Hot answers tagged

4

We could do that with two queries: First we fetch the post ids we need with the first query and then we merge it with our sticky post ids and feed it into the second query, using the post__in parameter for filtering and ordering: $args = [ 'post_type' => 'products' 'posts_per_page' => 12, 'orderby' => ...


4

If you need to: page the query retain 12 posts per page instead of "sticking" the desired posts on top of the required 12 only need to show those posts on the first page you can try the following $ids_args = [ 'post_type' => 'products' 'posts_per_page' => -1, 'orderby' => 'meta_value_num', 'meta_key' => ...


3

This allows for the message to be overwritten specifically for the loggedout message while leaving all other messages alone. Here is more documentation on the filter. add_filter( 'wp_login_errors', 'my_logout_message' ); function my_logout_message( $errors ){ if ( isset( $errors->errors['loggedout'] ) ){ $errors->errors['loggedout'][0] = ...


2

I think you are on the right track, but that last part is messy. You are using the bw_add_markup_class function for two different purposes : to return the classes that you want to add to list the context of the filters that you want to call If I understand well want you are trying to do, you need a function to return the array and then apply your ...


2

Filters are for modifying data that's passed through them. You need to take the input, modify it, then return it. function exclude_not_allowed_terms( $args, $taxonomies ) { if(!current_user_can('edit_others_posts') && in_array( 'my-taxonomy', $taxonomies ) ) { $args['meta_query'] = array( array( 'key' ...


1

Based on Sven's recommended solution and Tom J Nowell's warning about gettext() (see comments for both), I've fashioned the following solution: add_filter( 'login_message', 'wpse_215289_custom_logout_message' ); add_action( 'login_head','wpse_215289_custom_login_head' ); // Detect logout and add custom message. function wpse_215289_custom_logout_message() ...


1

I don't see a filter in wp-login for the title, but it does use __() so you might be able to use the gettext filter like: add_filter('gettext', 'wpse_214367_change_login_title', 20, 3); function wpse_214367_change_login_title( $translated_text, $untranslated_text, $domain ) { if( "Log In" == $untranslated_text ) $translated_text = "My ...


1

Because you only return $content from inside your if - you should always return it: function beschreibung_kriterien( $content ) { if ( is_page_template( 'template-test.php' ) ) { $content .= '<h2>Test</h2>'; } return $content; } add_filter( 'the_content', 'beschreibung_kriterien', 5 ); This just goes to the show the ...


1

This line in functions.php is your problem: $cat_id = get_post_meta($_REQUEST['cat']); I think you are misunderstanding the purpose of the get_post_meta() function. It is designed to get metadata for a WordPress Post, not data from a POST request to the site. The first parameter of the get_post_meta() function is the $post_id, but since you are passing ...


1

Here is an example of what I've done: <?php $link = home_url( '/members/' . bp_core_get_username( bp_displayed_user_id() ) . '/followers/' ); echo "<a href='". esc_attr( $link ) ."'>Followers</a>"; ?> So maybe its home_url now, than site_url. In the echo, esc_attr gives out the $link. Change the whole bp_core_get_username( ...



Only top voted, non community-wiki answers of a minimum length are eligible