Stefan Vasiljevic
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: The layout deforms if I add a border on hover.So if you need to have a border on hover, you should have a transparent border on the initial state and then just change the
border-color
on hover. That won’t make your layout “jumpy”Example:
.my-element{ border: 1px solid transparent; } .my-element:hover{ border-color: #000; }
Forum: Fixing WordPress
In reply to: unyson editor in wordpress not visibleIs there any JS errors in your console?
Forum: Plugins
In reply to: [WooCommerce] How/where do i edit product box structure?Well, it’s a html thing you can’t nest
<a>
into an<a>
element, if Add to cart button should link to the product page you should change the label to View Product or so.If it adds the product directly to cart you should extract it from the wrapping
<a>
element.I’d suggest to wrap the image and product name in 2 separate
<a>
elements so they are clickable and linking to the product page, and the Add to cart can be below that.You’re half way there. Basically you now need to get the products that belong to the category and their prices, after that simply determine min-max prices:
$orderby = 'name'; $order = 'asc'; $hide_empty = false ; $cat_args = array( 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => 0 ); $product_categories = get_terms( 'product_cat', $cat_args ); if( !empty($product_categories) ){ echo ' <ul>'; foreach ($product_categories as $key => $category) { // Get all products from this category // https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query $products = wc_get_products(array( 'category' => array($category->slug), 'limit' => -1 )); $all_prices = array(); //get all prices from this category foreach ($products as $product) { $all_prices[] = (float)$product->get_price(); } //Get minimum & maximum value from the price array $min_price = min($all_prices); $max_price = max($all_prices); echo ' <li>'; echo '<a href="'.get_term_link($category).'" >'; echo $category->name . '('.$min_price.' - '.$max_price.')'; // changed here echo '</a>'; echo '</li>'; } echo '</ul>'; }
Forum: Fixing WordPress
In reply to: Comments go to an image file page@tommyshanks I’m glad it helped! You’re welcome ??
Forum: Fixing WordPress
In reply to: Want to target a banner on only one pageYou’re welcome, I’m glad it helped!
Forum: Plugins
In reply to: [WooCommerce] How/where do i edit product box structure?Take a look at the
wp-content/plugins/woocommerce/templates/content-product.php
file that file is controlling the structure of the product card.To override that file in your theme copy it to:
wp-content/themes/your-theme/woocommerce/content-product.php
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Fixing WordPress
In reply to: Login error “There has been a critical error on this website”You have the function named
retrieve_password
multiple times, it’s either in your theme or in some of the plugins.When creating functions in WordPress always use a prefix such as
mytheme_retrieve_password
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Fixing WordPress
In reply to: Comments go to an image file pageLooks like you have comments open on attachment pages.
To disable it for an individual media file (image) please follow next steps:
1. Select Media > Library from the dashboard.
2. Click the media item you want to edit.
3. Select Edit more details in the right panel.
4. Under the Discussion section, uncheck the box next to Allow comments. This region might be hidden. If so, display it by selecting Discussion in Screen Options on top right of the screen.
5. Uncheck Allow Comments and click Update.To disable those comments programatically for all attachment pages, you can add the following snippet to your themes
functions.php
function wdc_filter_media_comment_status( $open, $post_id ) { $post = get_post( $post_id ); if( $post->post_type == 'attachment' ) { return false; } return $open; } add_filter( 'comments_open', 'wdc_filter_media_comment_status', 10 , 2 );
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Fixing WordPress
In reply to: Want to target a banner on only one pageHi @ladyofthecave,
that’s strange, most themes will add the post id to body class.
Here is a snippet to add the body class, add it to your
functions.php
file.add_filter( 'body_class','wdc_body_classes', 99 ); function wdc_body_classes( $classes ) { if(is_single() || is_page()){ $classes[] = 'entry-id-'.get_the_id(); } return $classes; }
If you need id for other types, please check this:
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Developing with WordPress
In reply to: Wp Mail Success or Failure IssueYou need to set the variable earlier and not inside an IF conditional, that way if it doesn’t go to IF you’ll have an undefined variable. Please try with the code below:
//... $result_for_reject = false; // default value if (!empty($_POST) && wp_verify_nonce($_POST['mail_control'], 'mail_control')) { //... if(!get_post_meta($order_id, 'reject_email', true)){ update_post_meta($order_id, 'reject_email', true); $to = $recipient_mails; $subject = 'Rejected'; $body = $message; $headers = array('Content-Type: text/html; charset=UTF-8','From:MyWebSite <[email protected]>'); $result_for_reject = wp_mail($to, $subject, $body, $headers); // when sent should be true } } //... //Pop-up window finished //Check email is sent or not sent if($result_for_reject){ echo '<div class="woocommerce-message " role="alert">Successful.</div>'; }else{ echo '<div class="woocommerce-error " role="alert">Unsuccessful.</div>'; }
Forum: Plugins
In reply to: [WooCommerce] Vertical single product image too bigSeems like a JS or CSS issue to me. Basically you should have a carousel on the right but it’s not showing correctly. Do you have any errors in the console?
Forum: Plugins
In reply to: [WooCommerce] Registration pageHi @metalsunny by default customer registration is not available as a separate page. It’s included on the My Account page besides the login form.
You can create a separate registration page but it requires some custom development.
I’m not sure is there any plugins that can do the trick for this one.
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic. Reason: add text
Forum: Plugins
In reply to: [WooCommerce] How/where do i edit product box structure?Basically there are 2 ways to customize the output:
1. By using actions and filters WooDocs
2. By doing a template override Docs on template overrideMethod #1 is the preferred method, but if you are not proficient with WordPress/WooCommerce, it can be a bit difficult.
Method #2 will work but it can break with some future updates of WooCommerce especially if you’re doing heavy customizations.
Forum: Plugins
In reply to: [WooCommerce] Corrupt .htaccess fileHi @el-pablo,
Both WordPress and WooCommerce can rewrite your .htaccess file in order to set the correct permalink structure. But they do it only when you Settings->Permalinks and click Save Changes.
Other plugins that can affect your .htaccess file are caching plugins, please try to disable them and give it a try.