Only display videos and images in the_content() within loop

We can do that with the help of the get_media_embedded_in_content() function: /** * Display only the first media item in the content * * @link http://wordpress.stackexchange.com/a/199398/26350 */ ! is_admin() && add_filter( ‘the_content’, function( $content ) { // Get the avialable media items from the content add_filter( ‘media_embedded_in_content_allowed_types’, ‘wpse_media_types’ ); $media = get_media_embedded_in_content( $content ); remove_filter( … Read more

create a page which displays a list of categories title+ short description?

You just need to add some conditional to aplly the filter or not. For example, if you don’t want to apply the trimming on category archive pages, one possible solution could be: add_filter( ‘category_description’, ‘cyb_trim_category_desc’, 10, 2 ); function cyb_trim_category_desc( $desc, $cat_id ) { // Apply only if we are not in category archive template … Read more

How to Filter Posts by Custom Fields?

Since you have not provided any code, below code snippet assumes a ‘property’ as post type and price as meta field. I think the code will provide you some direction and you can take it from there. Feel free to make changes as needed: $args = array(‘post_type’ => ‘property’, ‘meta_key’ => ‘price’, ‘orderby’ => ‘meta_value’, … Read more

Alternate row and columns every X posts

First of all you don’t know if you have posts number dividable by 11 in your case, so what will happen if at the end of your loop you end up with let’s say only 3 posts in your first section? Counter won’t reach 7 so your markup will be corrupted because of unclosed tags. … Read more

WordPress Redirects on Install

The problem was created by some code in the htaccess from root. So: To present exactly my configuration: I have – http://maindomain.org with file directly in the root of my hosting. I know this may not be a best practice and i’ll change this. Subdomain i was trying to set was in a folder which … Read more

Complex query and posts pagination

First of all, the post_nav_link() function is used to paginate the main query on home and archive pages. It does not work with custom queries (unless you hack the main query which I strongly discourage, it is the same as using query_posts then). To paginate your custom query, you need to use next_posts_link() previous_posts_link() which … Read more