Custom php file in wordpress

Andrew Bartel is on the right path, but the link doesn’t quite do what you want. For static PHP files to access WordPress core functionality you need to add this to the top of the PHP file: define(‘WP_USE_THEMES’, true); /** Loads the WordPress Environment and Template */ require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ ); (This … Read more

Theme Twenty Fifteen: Customize Color Scheme Customizer

It seems that you are modifying directly the twentyfifteen_get_color_schemes() function on parent theme or redeclaring it on your child theme. You should avoid both cases. In the original code from twenty fifteen can see this: apply_filters( ‘twentyfifteen_color_schemes’, array(…..) ); That means that you can create a filter to add extra color schemes in this way: … Read more

Adding extra info via GET while registeration in wordpress

I’ve recently written an affiliate plugin where i had to do pretty much the same stuff. Here’s a chopup of the relevant parts: To process the extra info you get from the registration form: add_action(‘user_register’, ‘my_handle_signup’, 10, 2); function my_handle_signup($user_id, $data = null) { $reg_ip = $_REQUEST[‘reg_ip’]; $referrer = $_REQUEST[‘referrer’]; if (isset($reg_ip) && isset($referrer)) { … Read more

Comment filtering (search)

You create your own comments_template, it can be a duplicate function of the default one, the only changes are the database queries anyway. But you need your own function as WP doesn’t help you with filters here. SO, name it my_comments_template(): $filter = mysql_real_escape_string($_POST[‘comment-filter’]); if(!empty($filter)) $filter = “AND (comment_content LIKE ‘%%{$filter}%%’ OR comment_author LIKE ‘%%{$filter}%%’)”; … Read more

WooCommerce Checkout page customization [closed]

To add the product image to the checkout review order page, you want to add the following into your functions.php file of your theme. function my_add_order_review_product_image( $product, $product_obj ) { $image = wp_get_attachment_image( get_post_thumbnail_id( $product_obj->post->ID ), ‘shop_thumbnail’ ); return $image . $product; } add_filter( ‘woocommerce_checkout_product_title’, ‘my_add_order_review_product_image’, 10, 2 ); This is utilizing the filter hook … Read more

How to show only Standard Format post in my custom taxonomy page -wordpress 3.8.1

Looking at your comment, photos and videos aren’t custom post types but actually categories. I’m changing my answer to reflect your comment. You can use pre_get_posts to exclude specific categories in your loop. You can achieve that with $query->set( ‘cat=-1,-2,-3′ ); This will exclude categories with ID’s 1, 2 and 3, and will only show … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)