Functions Error: Impacting Galleries

You can try to add the condition $query->is_main_query() in your if-sentences so it won’t affect the gallery queries: // Posts per page add_filter(‘parse_query’, ‘wpq_parse_query’); function wpq_parse_query($query) { if(!$query->is_main_query()) { return $query; } if($query->is_archive()) { $query->query_vars[‘posts_per_page’] = get_option(‘to_count_archives’, 1); } if($query->is_home()) { $query->query_vars[‘posts_per_page’] = get_option(‘to_count_home’, 1); } if($query->is_search()) { $query->query_vars[‘posts_per_page’] = get_option(‘to_count_search’, 1); } return $query; … Read more

customize wordpress database error page

This works fine for me as db-error.php in wp-content: Delete the mailer block if you don’t want it <?php header(‘HTTP/1.1 503 Service Temporarily Unavailable’); ?> <?php $to = “[email protected]”; $subject = “My Database is down”; $message = “My Database is down”; $headers = “MIME-Version: 1.0\n”; $headers .= “Content-type: text/plain; charset=iso-8859-1\n”; $headers .= “X-Mailer: php\n”; $headers … Read more

@file_get_contents and wp_remote_get

Check the docs. file_get_contents() and wp_remote_get() are not equivalent. file_get_contents() returns a string. wp_remote_get() returns either an array or a WP_Error object. You need to look at wp_remote_post() to see the format of that array: Array ( [headers] => Array ( [date] => Thu, 30 Sep 2010 15:16:36 GMT [server] => Apache [x-powered-by] => PHP/5.3.3 … Read more

Custom Meta Box Causing Error: “Are you sure you want to do this? Please try again.”

so you need to correct your nonce field add a second pram nonce name, more information on WordPress codex here // wp nonce field wp_nonce_field( $action, $name, $referer, $echo ); // replace yours with below wp_nonce_field( ‘ind_pricing_table_box_nonce’, ‘ind_pricing_nonce’ ); now verify your nonce, more info here wp_verify_nonce( $nonce, $action ); // replace yours with below … Read more

Trying to get property of non-object error with thumbnail

I believe from your error that you are using this code inside the loop. You should be using the_post_thumbnail(). The code you are using is used outside the loop. EDIT It is always good practice to always first check if you have a thumbnail to display So you should use <?php if(has_post_thumbnail()): ?> <a href=”https://wordpress.stackexchange.com/questions/142235/<?php … Read more

Weird string offset errors when displaying post attachments

Since you’ve used the true argument for get_post_meta, $blogimages will be a single array, not a multidimensional one. So instead of $blogimages[0][‘blog-image-inside’], just use $blogimages[‘blog-image-inside’]. For absolute sanity, you might also want to check $blogimages before you use it: ‘exclude’ => [ $thumb_ID, isset( $blogimages[‘blog-image-inside’] ) ? $blogimages[‘blog-image-inside’] : 0, isset( $blogimages[‘blog-image-front’] ) ? $blogimages[‘blog-image-front’] … Read more