WordPress, WordPress development

Make Author.php Include Custom Post Types

I was going through a strange issue where Author page was not showing the posts which belongs to Custom Post Types. After Googling, I found this article which shows how to include Custom Post Types for archives.php

I got inspiration from above mentioned article snippet and wrote the following snippet to modify Author.php page to include Custom Post Types

function wpbrigade_author_custom_post_types( $query ) {
  if( is_author() && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set( 'post_type', array(
     'post', 'my-custom-post-type-here'
		));
	  return $query;
	}
}
add_filter( 'pre_get_posts', 'wpbrigade_author_custom_post_types' );

 

how to check a specific plugin is activated or not

How to check a specific plugin is activated or not ?

While working on the EDD (Easy Digital Downloads) add-on of Analytify, I was looking for a way to check if the Easy Digital Downloads plugin is already activated or not. So, a message should appear to our users that “They should Activate Easy Digital Downloads to make the Analytify for EDD work properly.

Almost every plugin has a class name, we can use the PHP functionclass_exists‘ to know if it exists or not. Following is the code which can be used to check a plugin is activate or not.

add_action( 'admin_notices', array(
                                  &$this,
                                  'analytify_edd_plugin_notices'
));
public function analytify_edd_plugin_notices() {

if( !class_exists( 'Easy_Digital_Downloads' ) )
echo "<div class="error">" . __( "Easy Digital Downloads is not active. So, Analytify for EDD Add-on will not work properly.", 'wp-analytify' )."</div>";

}

If you know any other way to achieve the same task, do let us know.  Thanks.

how to make author.php include custome post types

How To Find Your Purchase Code From CodeCanyon Or Themeforest?

As we all know CodeCanyon is basically a platform of selling and purchasing of codes and plugins, supported by  Envato Market to back the programming enthusiasts for their love of coding. And if you have used CodeCanyon for buying something cool, you would be looking to track your purchase for sure.

Don’t worry, It’s very easy to find your purchase code  for codecanyon.  Just go to codecanyon.net/downloads

You will see your all downloaded items. see Next to your item, there is a download button.

You will click on the “License certificate & purchase code” option. This will download a txt file. Within this text file, you will find the license information for the product, including the purchase code (like below)

Item Purchase Code: de4d99d8-Iam-code-d066d1acd5a3

The purchase code can be then copy paste  to send this for validating your purchase and so it can be added for you to Support forums.

Thanks!