Retina JS not working

The documentation for Retina JS states that images need to have the data-rjs attribute set in order for them to opt in to using the script. This can be done using the third parameter of get_the_post_thumbnail() : <?php echo get_the_post_thumbnail( get_the_ID(), ‘thumbnail’, array( ‘data-rjs’ => ‘3’ ) ); ?>

Understanding Theme specific Code

do_action(); creates an action hook which we can use to hook our function in function.php file. in the above code, 4 action hooks are defined cherry_footer_before cherry_footer cherry_footer_after cherry_body_end if you go to theme-folder/lib/structure.php you wil see three action hooks. add_action( ‘cherry_footer_before’, ‘cherry_footer_wrap’, 999 ); add_action( ‘cherry_footer_after’, ‘cherry_footer_wrap’, 0 ); add_action( ‘cherry_footer’, ‘cherry_footer_load_template’ ); and … Read more

Theme Check warning wrong direcory for theme

The problem is with your theme directory name. it usually resides here: /wp-content/themes/ then check if your theme name and directory name matches. you can change it in your computer or FTP client easily. if through terminal, use this command: $ sudo mv -v OLDDIRECTORY NEWDIRECTORY

Create register form without a plugin

In your PHP, use wp_create_user(). With this function, you can pass username, email and `password’. Then, wp update user() to give the user the other bits of info. I would hook my user-creation function to the init hook. Also, you want to put a nonce field in your form e.g. this, between the <form> tags: … Read more

I have some doubts regarding how to implement child theme

The first function should be there in your parent theme functions.php file. Parent Theme Code <?php if ( ! function_exists( ‘my_theme_enqueue_scripts’ ) ) { function my_theme_enqueue_scripts() { add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); } } ?> Child Theme Code Now place the following code in your child theme. … Read more

Inject widgets from one sidebar into another with PHP

Here’s an (untested) idea where we inject the sidebar-inject sidebar before sidebar-target sidebar with help of the dynamic_sidebar_before hook : add_action( ‘dynamic_sidebar_before’, ‘wpse_inject_sidebar’, 10, 2 ); function wpse_inject_sidebar( $index, $has_widgets ) { // Only target front-end if( is_admin() ) return; // Only target ‘sidebar-target’ if( ‘sidebar-target’ !== $index ) return; // Make sure ‘sidebar-inject’ is … Read more

OptimizePress Theme Overriding add_filter page_template

Had to switch the filter to the template_include hook. Don’t know if that is the correct way to do it, but it works: function _plc_template_include ($template) { $pages = _plc_get_custom_pages(); foreach ($pages as $slug => $title) { if (is_page ($slug) && is_file (PLC_TEMPLATES . $slug . ‘.tpl.php’)) { ob_start(); include PLC_TEMPLATES . $slug . ‘.tpl.php’; … Read more