isadoe
Forum Replies Created
-
Hi again,
My problem is solved 🙂 A few days ago I also asked for help on the Woocommerce support forum (since the issue were related to both Twenty Nineteen theme and Woocommerce plugin) and today we found what was wrong there (see the thread here).
A curly bracket was misplaced in my child-theme functions.php. Once it was moved to its right place, adding the following code to the file made me able to custom the main image width:
function mytheme_add_woocommerce_support() { add_theme_support( 'woocommerce', array( 'thumbnail_image_width' => 300, 'single_image_width' => 600, ) ); } add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );Thank you Jarret for trying to help, you couldn’t find what was wrong without having access to my functions.php file.
Have a nice day,
IsabelleYaay, you made my day, it works! Haha, thank you for your help and your patience, I knew that all could come down to a bracket and here’s the perfect example. I didn’t see that error because it wasn’t marked with a red cross in my editor…
Everything works fine now, thanks again and have a nice day 🙂
Isabelle
EDIT : Oops, I wrote too fast! Adding the code to the plugin indeed made the “main image width” customization part come back, BUT my site disappeared in the process…. it’s a white empty page now..
Original answer :
Hi Etienne,
It works like a charm when I use the Code Snippets plugin, thanks so much!
Any idea why it works with the plugin and not with my functions.php file? (it would be perfect if it could work with my file, I’m trying to use as less plugins as I can)Here’s my function.php file, maube there’s a basic error since I’m new to coding.. :
<?php /** ** activation theme **/ add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); /*-----------------------------------------------------------------------------------*/ /* FAIRE REAPPARAITRE OPTION WOOCOMMERCE DANS MENU PERSONNALISER THEME */ /*-----------------------------------------------------------------------------------*/ function remove_woocommerce_support() { remove_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'remove_woocommerce_support'); /*-----------------------------------------------------------------------------------*/ /* MODIF COMMENTAIRES */ /*---------------------------------------------------------woocom--------------------------*/ /* COMMENTAIRES EN EUX MEME :*/ /*couleur des commentaires . EST APPELE ligne 38 de comments.php de JL */ function isabelle_comments_callback ($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>" class="comment-container"> <div class="comment-avatar"> <?php echo get_avatar( $comment->comment_author_email, 80 ); ?> </div> <div class="comment-text"> <header class="comment-author"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <span class="author"><cite><?php printf( esc_html__('%s','twentynineteen'), get_comment_author_link());?> </cite> </span> <time datetime="<?php echo get_comment_date("c")?>" class="comment-date"> <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(esc_html__('%1$s at %2$s','twentynineteen'), get_comment_date(), get_comment_time()) ?></a> - <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> <?php edit_comment_link(esc_html__('(Edit)','twentynineteen')) ?> </time> </header> <?php if ($comment->comment_approved == '0') : ?> <br /><em><?php esc_html_e('Your comment is awaiting approval.','twentynineteen') ?></em> <?php endif; ?> <?php comment_text() ?> </div> <div class="clear"></div> </div> <?php } /* FORMULAIRE AJOUTER UN COMMENTAIRE : mettre placeholders a l interieur des champs commentaire : */ /* version avec légende au-dessus cases : function isabelle_update_comment_fields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $label = $req ? '*' : ' ' . __( '(optional)', 'text-domain' ); $aria_req = $req ? "aria-required='true'" : ''; $fields['author'] = '<p class="comment-form-author"> <label for="author">' . __( "", "text-domain" ) . $label . '</label> <input id="author" name="author" type="text" placeholder="' . esc_attr__( "Votre nom *", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" ' . $aria_req . ' /> </p>'; $fields['email'] = '<p class="comment-form-email"> <label for="email">' . __( "Email", "text-domain" ) . $label . '</label> <input id="email" name="email" type="email" placeholder="' . esc_attr__( "Votre adresse email *", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" ' . $aria_req . ' /> </p>'; $fields['url'] = '<p class="comment-form-url"> <label for="url">' . __( "Website", "text-domain" ) . '</label> <input id="url" name="url" type="url" placeholder="' . esc_attr__( "http://google.com", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /> </p>'; return $fields; } add_filter( 'comment_form_default_fields', 'isabelle_update_comment_fields' ); */ /* version SANS legende : */ function isabelle_update_comment_fields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $label = $req ? '*' : ' ' . __( '(optional)', 'text-domain' ); $aria_req = $req ? "aria-required='true'" : ''; $fields['author'] = '<p class="comment-form-author"> <input id="author" name="author" type="text" placeholder="' . esc_attr__( "Votre nom *", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" ' . $aria_req . ' /> </p>'; $fields['email'] = '<p class="comment-form-email"> <input id="email" name="email" type="email" placeholder="' . esc_attr__( "Votre adresse email *", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" ' . $aria_req . ' /> </p>'; $fields['url'] = '<p class="comment-form-url"> <label for="url">' . __( "Website", "text-domain" ) . '</label> <input id="url" name="url" type="url" placeholder="' . esc_attr__( "http://google.com", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /> </p>'; return $fields; } add_filter( 'comment_form_default_fields', 'isabelle_update_comment_fields' ); function isabelle_update_comment_field( $comment_field ) { $comment_field = '<p class="comment-form-comment"> <textarea required id="comment" name="comment" placeholder="' . esc_attr__( "Au plaisir de vous lire ! :)", "text-domain" ) . '" cols="45" rows="8" aria-required="true"></textarea> </p>'; return $comment_field; } add_filter( 'comment_form_field_comment', 'isabelle_update_comment_field' ); function comment_form_isabelle( $args = array(), $post_id = null ) { if ( null === $post_id ) { $post_id = get_the_ID(); } // Exit the function when comments for the post are closed. if ( ! comments_open( $post_id ) ) { /** * Fires after the comment form if comments are closed. * * @since 3.0.0 */ do_action( 'comment_form_comments_closed' ); return; } $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $args = wp_parse_args( $args ); if ( ! isset( $args['format'] ) ) { $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; } $req = get_option( 'require_name_email' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = 'html5' === $args['format']; $fields = array( 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' . '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>', ); if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) { $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' . '<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>'; // Ensure that the passed fields include cookies consent. if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { $args['fields']['cookies'] = $fields['cookies']; } } $required_text = sprintf( ' ' . __( 'Required fields are marked %s' ), '<span class="required">*</span>' ); /** * Filters the default comment form fields. * * @since 3.0.0 * * @param string[] $fields Array of the default comment fields. */ $fields = apply_filters( 'comment_form_default_fields', $fields ); $defaults = array( 'fields' => $fields, 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p>', /** This filter is documented in wp-includes/link-template.php */ 'must_log_in' => '<p class="must-log-in">' . sprintf( /* translators: %s: login URL */ __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ) . '</p>', /** This filter is documented in wp-includes/link-template.php */ 'logged_in_as' => '<p class="logged-in-as">' . sprintf( /* translators: 1: edit user link, 2: accessibility text, 3: user name, 4: logout URL */ __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ), get_edit_user_link(), /* translators: %s: user name */ esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ) . '</p>', 'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>' . ( $req ? $required_text : '' ) . '</p>', 'comment_notes_after' => '', 'action' => site_url( '/wp-comments-post.php' ), 'id_form' => 'commentform', 'id_submit' => 'submit', 'class_form' => 'comment-form', 'class_submit' => 'submit', 'name_submit' => 'submit', 'title_reply' => __( 'Leave a Reply' ), 'title_reply_to' => __( 'Leave a Reply to %s' ), 'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">', 'title_reply_after' => '</h3>', 'cancel_reply_before' => ' <small>', 'cancel_reply_after' => '</small>', 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), 'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />', 'submit_field' => '<p class="form-submit">%1$s %2$s</p>', 'format' => 'xhtml', ); /** * Filters the comment form default arguments. * * Use {@see 'comment_form_default_fields'} to filter the comment fields. * * @since 3.0.0 * * @param array $defaults The default comment form arguments. */ $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); // Ensure that the filtered args contain all required default values. $args = array_merge( $defaults, $args ); /** * Fires before the comment form. * * @since 3.0.0 */ do_action( 'comment_form_before' ); ?> <div id="respond" class="comment-respond"> <?php echo $args['title_reply_before']; comment_form_title( $args['title_reply'], $args['title_reply_to'] ); echo $args['cancel_reply_before']; cancel_comment_reply_link( $args['cancel_reply_link'] ); echo $args['cancel_reply_after']; echo $args['title_reply_after']; if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) : echo $args['must_log_in']; /** * Fires after the HTML-formatted 'must log in after' message in the comment form. * * @since 3.0.0 */ do_action( 'comment_form_must_log_in_after' ); else : ?> <form action="<?php echo esc_url( $args['action'] ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>" class="<?php echo esc_attr( $args['class_form'] ); ?>"<?php echo $html5 ? ' novalidate' : ''; ?>> <?php /** * Fires at the top of the comment form, inside the form tag. * * @since 3.0.0 */ do_action( 'comment_form_top' ); if ( is_user_logged_in() ) : /** * Filters the 'logged in' message for the comment form for display. * * @since 3.0.0 * * @param string $args_logged_in The logged-in-as HTML-formatted message. * @param array $commenter An array containing the comment author's * username, email, and URL. * @param string $user_identity If the commenter is a registered user, * the display name, blank otherwise. */ echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); /** * Fires after the is_user_logged_in() check in the comment form. * * @since 3.0.0 * * @param array $commenter An array containing the comment author's * username, email, and URL. * @param string $user_identity If the commenter is a registered user, * the display name, blank otherwise. */ do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); else : echo $args['comment_notes_before']; endif; // Prepare an array of all fields, including the textarea $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; /** * Filters the comment form fields, including the textarea. * * @since 4.4.0 * * @param array $comment_fields The comment fields. */ $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); // Get an array of field names, excluding the textarea $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); // Get the first and the last field name, excluding the textarea $first_field = reset( $comment_field_keys ); $last_field = end( $comment_field_keys ); foreach ( $comment_fields as $name => $field ) { if ( 'comment' === $name ) { /** * Filters the content of the comment textarea field for display. * * @since 3.0.0 * * @param string $args_comment_field The content of the comment textarea field. */ echo apply_filters( 'comment_form_field_comment', $field ); echo $args['comment_notes_after']; } elseif ( ! is_user_logged_in() ) { if ( $first_field === $name ) { /** * Fires before the comment fields in the comment form, excluding the textarea. * * @since 3.0.0 */ do_action( 'comment_form_before_fields' ); } /** * Filters a comment form field for display. * * The dynamic portion of the filter hook, <code>$name</code>, refers to the name * of the comment form field. Such as 'author', 'email', or 'url'. * * @since 3.0.0 * * @param string $field The HTML-formatted output of the comment form field. */ echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; if ( $last_field === $name ) { /** * Fires after the comment fields in the comment form, excluding the textarea. * * @since 3.0.0 */ do_action( 'comment_form_after_fields' ); } } } $submit_button = sprintf( $args['submit_button'], esc_attr( $args['name_submit'] ), esc_attr( $args['id_submit'] ), esc_attr( $args['class_submit'] ), esc_attr( $args['label_submit'] ) ); /** * Filters the submit button for the comment form to display. * * @since 4.2.0 * * @param string $submit_button HTML markup for the submit button. * @param array $args Arguments passed to comment_form(). */ $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args ); $submit_field = sprintf( $args['submit_field'], $submit_button, get_comment_id_fields( $post_id ) ); /** * Filters the submit field for the comment form to display. * * The submit field includes the submit button, hidden fields for the * comment form, and any wrapper markup. * * @since 4.2.0 * * @param string $submit_field HTML markup for the submit field. * @param array $args Arguments passed to comment_form(). */ echo apply_filters( 'comment_form_submit_field', $submit_field, $args ); /** * Fires at the bottom of the comment form, inside the closing </form> tag. * * @since 1.5.0 * * @param int $post_id The post ID. */ do_action( 'comment_form', $post_id ); ?> </form> <?php endif; ?> </div><!-- #respond --> <?php /** * Fires after the comment form. * * @since 3.0.0 */ do_action( 'comment_form_after' ); } /* mettre champs nom et email AVANT celui commentaire */ if ( !wp_is_mobile() ) { function isabelle_move_comment_field_to_bottom( $fields ) { $comment_field = $fields['comment']; unset( $fields['comment'] ); $fields['comment'] = $comment_field; return $fields; } add_filter( 'comment_form_fields', 'isabelle_move_comment_field_to_bottom' ); } /* retrait website */ add_filter( 'comment_form_defaults', 'isabelle_manage_default_fields'); // $default contient tous les messages du formulaire de commentaire // il contient également "comment_field", le textarea du message if ( !function_exists('isabelle_manage_default_fields')) { function isabelle_manage_default_fields( $default ) { // Récupération des infos connues sur le visiteur // Permet de pré-remplir nos nouveaux champs $commenter = wp_get_current_commenter(); // Suppression d'un champ par défaut parmi : author, email, url unset ( $default['fields']['url'] ); // On retourne le tableau des champs return $default; } } /*-----------------------------------------------------------------------------------*/ /* AJOUTER BOUTON CONTINUER SHOPPING DANS PANIER */ /*-----------------------------------------------------------------------------------*/ add_action( 'woocommerce_after_cart_totals', 'isa_continue_shopping_button' ); function isa_continue_shopping_button() { // On récupère le lien de votre page boutique $shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) ); // On ajoute notre bouton echo '<div class="isa-continue-shopping">'; echo ' <a href="'.$shop_page_url.'" class="button isa-shopping-button">Ou continuer le shopping</a>'; echo '</div>'; } /*-----------------------------------------------------------------------------------*/ /* BOUTON BACK TO TOP (lié à fichier js créé par moi) */ /*-----------------------------------------------------------------------------------*/ /** * Enqueue button javascript script. */ function themeslug_add_button_script() { wp_enqueue_script( 'custom-script', get_stylesheet_directory_uri() . '/js/back-to-top.js', array( 'jquery' ) ); } add_action( 'wp_enqueue_scripts', 'themeslug_add_button_script' ); /** * Add button HTML to the footer section. */ function themeslug_add_scroll_button() { echo '<a href="#" id="topbutton"></a>'; } add_action( 'wp_footer', 'themeslug_add_scroll_button' ); }- This reply was modified 6 years, 7 months ago by isadoe.
Hi Jarret,
Yes you’re right, 579px would be the correct width. In fact, all I want is the image to be displayed full width in its column: I said 600 as a rounded figure. When I use 600px instead of 450px in the original “class-wc-twenty-nineteen.php” file it works all fine, my only issue is that I don’t know how to write this permanently in my child theme.
Hi Etienne,
Thank you for your answer!
I added your code to my child-theme functions.php but Customizing > WooCommerce > Product Images still only features the “Thumbnail cropping” part and not the “Main image width” one 🙁Isabelle
Hi again,
Does anybody have another idea on how to solve my issue please?
Isabelle
Hi Jarret, thank you for your answer but saddly it doesn’t work either 🙁
Thank you both for your answers!
I tried to edit the existing 404.php file (after duplicating it to my child theme) as you said but didn’t know how to import my whole ‘already-customized’ page in there without having to create a new different page (h1, paragraph, etc.) between your tags.
I found another solution that seems to work >> my 404 page was customized with Elementor. I deleted it and created it again with the exact same design but as a template this time, and not as a single page. I could choose it to be an “error-404 template design” and with all the magic of codes I’ve no idea of, it is now displayed as my 404 page ^^’
So thank you again very much for your help, even if I did not use your tips at the end I now know how to edit the 404.php file too.
Have a beautiful day,
IsabelleHi Jarret, and thank you for your answer! ^^
I thought about this indeed but since I’m a newbie to html I wasn’t sure how to do it.
I’m going to create a 404.php file in my child theme to overwrite the Twenty Nineteen one, but what code do I write inside to “call” my 404 error page please?Best regards,
IsabelleForum: Themes and Templates
In reply to: [Jane Lite] How to properly disable your Woocommerce design?Hi Alex,
Sorry for the late answer I was away for a few days.
When I turn the “Elementor Pro” widget off >> it completly breaks my website design (which is logical since I used Elementor Pro to build it) but the thumbnails are still missing..Isabelle
Forum: Themes and Templates
In reply to: [Jane Lite] How to properly disable your Woocommerce design?Oh, and now the whole site disappeared (only the top logo, the headbar and the background are displayed) after commenting the line 945. If I “uncomment” it it goes back to how it was (site well displayed but with the thumbnails issue).
Forum: Themes and Templates
In reply to: [Jane Lite] How to properly disable your Woocommerce design?Hi Alex, thank you for your answer!
I am using Elementor Pro.
Could you please comment the line 945 of suevafree/core/main.php file?
//require_once( trailingslashit( get_template_directory() ) . ‘/core/functions/function-woocommerce.php’ );
I did as you said and see no changes? Still no products thumbnails here https://www.dreamsonearth.com/boutique/ or for related products (example, bottom of this page https://www.dreamsonearth.com/produit/woo-logo-3/)
Thanks for trying to help,
IsabelleForum: Themes and Templates
In reply to: [Jane Lite] How to properly disable your Woocommerce design?Still working on this issue day after day with no solution, but in case you wonder when looking at my site : today I decided to leave “Jane Lite” and go back to its parent “Sueva Free”. I then created my own child theme from Suevafree where I’ve put only a very few changes.
>> The issue is still exactly the same, so it may be linked to Sueva Free.. ?