Earlier today, I posted an article about adapting the Lazyest Gallery comment-template. Although it works fine for my blogs, it doesn't for a lot of other sites.
Let's take another approach, and honestly, I have to say: 'This is the right way to do it';
For Lazyest Gallery to connect your comments to images or folders, you need to add some fields in the comment form. If your theme supports the WordPress filters, please add the following code to your :
function my_comment_id_fields() { if ( function_exists( 'lg_comment_id_fields' ) ) lg_comment_id_fields(); } add_action( 'comment_form', 'my_comment_id_fields'); function remove_commentor() { global $lg_gallery; remove_filter( 'comments_template', array( $lg_gallery->commentor, 'comments_template' ), 10, 1 ); } add_action( 'lazyest_ready', 'remove_commentor', 20 );
If this doesn't work, please contact your theme supplier and ask them to support the standard WordPress filters. If they can't or won't, you'll have to change your comments templates.
First, We make a >child theme for our theme and copy the comments.php template and the functions.php file in the child theme directory.
If you make your own theme, please go ahead and hack your own files ![]()
Open the comments.php file in your editor and just after the line that says something like:
// You can start editing here -- including this comment!
add the following code:
<?php if ( lg_login_required() ) : ?> <p class="nopassword"><?php esc_html_e( 'You should be logged in to view this page. Log in to view any comments.', 'lazyest-gallery' ); ?></p> </div><!-- #comments --> <?php return; endif; ?> <?php if ( lg_level_required() ) : ?> <p class="nopassword"><?php sprintf( esc_html_e( 'Sorry, you are not allowed to view this item.%1sThe owner of the gallery has set access restrictions', 'lazyest-gallery' ), '<br />' ); ?></p> </div><!-- #comments --> <?php return; endif; ?>
Now, search for the comment form. If it is not in comments.php or functions.php, copy the function from the original file into your child theme functions.php
Search in the comment form code for:
<?php comment_id_fields(); ?>
On a new line below this statement, put the code:
<?php lg_comment_id_fields(); ?>
All done? Now we have to disable the Lazyest Gallery comments template by adding the following code to functions.php
function remove_commentor() { global $lg_gallery; remove_filter( 'comments_template', array( $lg_gallery->commentor, 'comments_template' ), 10, 1 ); } add_action( 'lazyest_ready', 'remove_commentor', 20 );
Save your functions.php and now you have adapted your comments template to Lazyest Gallery.
If this does not work, e.g. you cant make a child theme as with WPTouch, please adapt the Lazyest Gallery comment template.
Pingback: How to allow comments only for Slides in Lazyest Gallery | Brimosoft
Pingback: How to adapt the Lazyest Gallery comment template | Brimosoft