Posts

Showing posts with the label wordpress

How to add a class to a WooCommerce product within the product loop

How to add a class to a WooCommerce product within the product loop I would like to add multiple bootstrap col classes to this line of code inside the product loop but I have no idea. <li><?php wc_product_class(); ?></li> Can I somehow push my classed into this bit of php and still keep the product applied? 2 Answers 2 try this <li <?php wc_product_class("col-md-4 col-sm-6 custom-class m-4"); ?>></li> <li <?php wc_product_class("col-md-4 col-sm-6 custom-class m-4"); ?>></li> For this wc_product_class(); uses two arguments one is class name and other one is product id so just pass your class name as first argument and product id in second one. wc_product_class(); you could see the wc_product_class() in /woocommerce/includes/wc-template-functions.php For example your class name is test and product id is 143 then just pass ...

Get advance custom field image

Image
Get advance custom field image i'm trying to get the object image that i inserted with acf. But the problem is: the code always return an array with only one index, that return a number (i think it's the id). you can set the ACF field to either return an ID of the image, or the object. – Stender Jul 2 at 9:59 I set the ACF to return an object, but he always return an id – D B Jul 2 at 10:01 how you are calling the field in template? – charan kumar Jul 2 at 10:06 foto-d-5, then i use get_field('foto-d-5') in...

Rewrite url for custom post type and custom taxomonies in wordpress

Rewrite url for custom post type and custom taxomonies in wordpress I have custom post type and custom taxonomies. Currently I am using custom category in my menus and url of that is. https://example.com/customposttypeslug/categories1 https://example.com/customposttypeslug/categories2 https://example.com/customposttypeslug/categories3 So i want to change this to as below https://example.com/categories1 https://example.com/categories2 https://example.com/categories3 I have gone through many articles on stack and google but i didnt find how to remove customposttype slug from url for custom post type. Here is the code for creating custom post type and taxonomies add_action('init', 'shopify_theme_app_cpt'); function shopify_theme_app_cpt() { register_post_type('apps', array( 'labels' => array( 'name' => 'Shopify Themes & Apps', 'singular_name' => 'Shopify Theme & App', ...

how to store html string in php variable using a foreach loop

how to store html string in php variable using a foreach loop I'm new to php . This is in relation to wordpress and I'm terribly confused. php Basically, I am passing an array of names from another file (via ajax and json ) and into a php function. This function will loop through each name and generate html code to display to the page with an image. I would like to store this html code as a string into a variable to be used in another part of my app (specifically to append it to a post to update in real time, but that's a separate issue). ajax json php html html My ajax response is showing the result I want, just not stored in a string. It is also saying the path to my images can't be found despite the path being correct. It seems like I'm either concatenating something wrong or putting quotes in the wrong place, or something else. I want to store all the html generated in $html_string (which I know won't load my app correctly as I'm displaying the cod...

How to group woocommerce products by category in WordPress

Image
How to group woocommerce products by category in WordPress I have at least 4 Parent Categories and each parent category has a sub-category. The categories in WordPress looks like this: Lidingö (Parent Category) Nacka (Parent Category) I want to query the products in WordPress and they should be grouped by categories. This is my current code: <?php $args = array( 'post_type' => 'product', array( 'taxonomy' => 'product_cat' ), 'posts_per_page' => 6, ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); echo woocommerce_template_single_title(); endwhile; } else { echo __( 'No products found' ); } wp_reset_postdata(); ?> I think the code above is not correct because the same products are being displayed for every pagination. Do you have any idea what is ...

Apache two apps one domain share language /en - Magento & Wordpress

Apache two apps one domain share language /en - Magento & Wordpress We have Wordpress in the root / in a physical subfolder /wp and Magento in /products. We are wanting to make the sites multi-language using sub folders e.g domain.com/en The problem arises as magento appends the store code (language) after the url so we have domain.com/en (wordpress) domain.com/products/en (magento) Naturally we would like domain.com/en domain.com/en/products Now it's very easy to make it work with some rewrite rule RewriteRule ^(.*)/products/?(.*)$ /products/$1 [L] But still we have an issue as Magento generates the links as /products/en it's possible to start modifying where these links are generated like in MagentoStoreModelStore In the _updatePathUseStoreView function, this doesn't seem to handle all links though In general seems like a bad solution, another idea is to use Apache mod_substitute also seems bad practice, and overhead. Another option is to have both apps in the root an...

removing padding from columns in wordpress

Image
removing padding from columns in wordpress Hi I want to remove padding from padding from columns in wordpress. http://codesigners.co.uk/nuala/restaurant/ looking at the code: .vc_column_container>.vc_column-inner { box-sizing: border-box; padding-left: 15px; <<<tied making this 0px padding-right: 15px; <<<tied making this 0px width: 100%; } also have tried editing the js_composer.min.css file. Any ideas? 1 Answer 1 Change settings of visual composer row : Row Settings > Row Stretch > Stretch row and content (no padding) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

the_post_thumbnail returns outside the the hyperlink

the_post_thumbnail returns outside the the hyperlink when I use get_the_post_thumbnail it returns the featured image default size inside <a></a> but when I use it without get to insert the predefined size name in function file it returns the desired size but outside the hyperlink. get_the_post_thumbnail <a></a> <?php $args = array('showposts' => 25); $the_query = new WP_Query( $args ); if( $the_query->have_posts() ): echo '<ul>'; while ( $the_query->have_posts()) : $the_query->the_post(); echo '<span><li><a href="'.get_the_permalink().'">' .the_post_thumbnail('shapely-grid').' '.get_the_title().'</a> <p>' .get_the_excerpt($limit).'</p></li></span>'; endwhile; echo '</ul>'; endif; wp_reset_query(); ?> 1 Answer 1 ...

Wordpress. Getting logo to be in front of menu or header

Wordpress. Getting logo to be in front of menu or header I am using the Avada theme and cannot figure out how to get the logo in front of the menu or header. It looks like the logo is part of the wrapper that contains the header, menu and logo. So if I change one, it affects the other. This is how the theme has the logo set up - https://imgur.com/NQN5ukO This is the desired style - https://imgur.com/EEOavLI Thank you if anyone can help. :3 Both are the same image? – Manoj Kumar Jun 30 at 21:14 So what are the concrete CSS and HTML snippets, or attempts to rewrite things. Screenshots alone rarely make a useful programming question. (Btw, plastering posts with "help" doesn't really help any future users.) – mario Jun 30 at 21:17 ...

Divi theme clashing with Yoast SEO

Divi theme clashing with Yoast SEO has anybody experienced the Divi theme builder clashing with Yoast SEO v.7.6? This problem occurred right after updating the Yoast plugin. I need some help please guy, as Yoast support doesn't seem to respond By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Get custom input and update to woocommerce

Get custom input and update to woocommerce I am modyfing a car reservation plugin in Wordpress. Plugin has an options to select from drop-down list like city and date. I had to add a field with a street name. It is a text input field. When I click MAKE A RESERVATION in the next step i can see in the small summary the street which has been provided in the field, but when i choose a car and go further, in the same small summary it just disappear. How to GET and SAVE this input to the end of making reservation form and show it in the general summary of woocommerce? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Adding custom variation field data to CSV order export - WooCommerce

Adding custom variation field data to CSV order export - WooCommerce I have been searching everywhere for an answer and just keep hitting road block after road block I have added custom variations fields in WooCommerce using http://www.remicorson.com/woocommerce-custom-fields-for-variations/ These fields save correctly when updating products. I have installed WooCommerce Customer / Order CSV Export and have added a meta_field column placing the meta_key found in the code below. Screenshot of the fields However when I export the CSV file the fields are empty. Anyone have any experience with getting the custom variation field data to appear when exporting order data via CSV. Listed below is the custom variation code being used. Any guidance would be greatly appreciated. /** * Create new fields for variations * */ function variation_settings_fields( $loop, $variation_data, $variation ) { // Text Field woocommerce_wp_text_input( array( 'id' ...

Having issues with my website's navbar display on PC and mobile

Having issues with my website's navbar display on PC and mobile I have limited coding skills, and built a portfolio website for myself utilizing WordPress, a pre-built theme called Ocean WP, and the Elementor plugin. The problem that I was facing earlier was that my nav menu had an arrow to indicate a drop down menu on one of my pages. I really didn't like how this looked, so I reached out to Wordpress Support for help, and was given this CSS code to input: /* eliminate dropdown arrow */ .elementor-navigation .menu-item-has-children > a:after { display:none; } While the code has worked to remove the arrow, it's left my nav menu with an uneven space. Additionally, I'm not sure how to make this code work on tablet/ mobile devices because the arrow still shows up. Please provide a Minimal, Complete, and Verifiable example. Please look at guide how do I ask a good question? – Andrzej Ziółek Jul 1 at 20:01...

Using Product CRUD setter methods in Woocommerce 3

Using Product CRUD setter methods in Woocommerce 3 In the code bellow, I can't set some product category and product tags: The code is located in my functions.php file: <?php $product = new WC_Product; $product->set_name("product"); $product->set_regular_price('150'); $set_cat = $product->set_category_ids( array(17) ); $set_tag = $product->set_tag_ids( [18, 19] ); $product->save(); var_dump($set_cat);//NULL var_dump($set_tag);//NULL The product is created with the correct name and price . But I get nothing for the product category and product tags: name price terms: [terms table][1] term_taxonomy: [term_taxonomy table][2] Edit: I have moved this code in index.php file and It works. index.php Could you add a bit more clarification to this question, what exactly are you trying to do and what aspect of it is not working, have you tried anything else to address the issue? – David Rogers ...

amazon EC2 - How to make wp-config.php to writable?

Image
amazon EC2 - How to make wp-config.php to writable? I'm using Amazon EC2 with Bitnami wordpress. I recently tried to use plugins, they install and activate well, but there are still errors. Those errors look like permission errors. Also, perhaps, how to make the whole wordpress directory writable? I'm only accessing through SSH. Some of the errors: "A definition of a siteurl or homeurl was detected in your wp-config.php, but the file is not writable. Set your wp-config.php to writable and reload this page." From W3 total Cache: Please add the error messages you get back. – Damien Feb 8 '17 at 12:42 one is: " A definition of a siteurl or homeurl was detected in your wp-config.php, but the file is not writable. Set your wp-config.php to writable and reload this page." ...

wordpress outputting extra html code

wordpress outputting extra html code I'm building a theme in WordPress, I'm a newbie, along with the image HTML is being outputted, please do help me resolve this issue, thank you. <?php $args = array( 'numberposts' => 4, 'order'=> 'ASC', 'orderby' => 'title', 'category' => '5' ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <li> <div class="timeline-image"> <a href="<?php the_permalink(); ?>"> <img class="rounded-circle img-fluid" src="<?php echo the_post_thumbnail(); ?>"> </a> </div> <div class="timeline-panel"> <div class="timeline-heading"> <h4 class="subhe...

An unexpected error occurred wordpress plugin install

An unexpected error occurred wordpress plugin install Hi there i am facing this issue on my wordpress dashboard when i tried to install new plugin from WordPress Repository it keep saying that Something went wrong with the plugin API. and when i tried to click on plugin name to get info it gives me this error An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. i need help for this i am using bluehost hosting and domain from godaddy and recently i transfer my domain to bluehost. Thanks Regards By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Javascript properly not works in Firefox ( toggle menu )

Javascript properly not works in Firefox ( toggle menu ) /* General styles for all menus */ .toggles-menu, .toggles-menu:hover, .toggles-menu:focus{ background : transparent; outline : o ;padding-right : 15px;border:none; box-shadow: none; outline: 0; cursor: pointer} .cbp-spmenu { background: #47a3da; position: fixed; } .cbp-spmenu h3 { color: #afdefa; font-size: 1.9em; padding: 20px; margin: 0; font-weight: 300; background: #0d77b6; } .cbp-spmenu a { display: block; color: #fff; font-size: 1.1em; font-weight: 300; } .cbp-spmenu a:hover { background: #258ecd; } .cbp-spmenu a:active { background: #afdefa; color: #47a3da; } /* Orientation-dependent styles for the content of the menu */ .cbp-spmenu-vertical { width: 240px; height: 100%; top: 0; z-index: 1000; overflow-y: scroll; } .cbp-spmenu-vertical a { border-bottom: 1px solid #258ecd; padding: 1em; } .cbp-spmenu-horizontal { width: 100%; ...

How to make file upload 'Required' in Contact Form 7?

How to make file upload 'Required' in Contact Form 7? I have a Contact Form 7 form on my Wordpress website and I have specified that the file upload is mandatory by putting a * , however the users are able to submit the form without file upload. * Relevant Contact Form 7 form is given below: <div class="filelink">[file* AddanImage filetypes:gif|png|jpg|jpeg]</div> How do I write the Contact Form 7 code or add a validation perhaps so that the users are not able to submit the form without uploading an image? Any hints/help/guidance is highly appreciated. Have you check doc - contactform7.com/file-uploading-and-attachment – Mukesh Panchal Jun 30 at 8:38 @MukeshPanchal I have and the code complies with the documentation – Hamza Ahmad Jul 1 at 10:44 ...

Redirect any directory if it has a specific query string

Redirect any directory if it has a specific query string I am trying to redirect all pages with a specific query string to another page. So many pages have this query string, but the URI's are different. I want to capture any URI and if it has this query string to redirect it but nothing I am doing is working. So just to be clear: http://example.com/?redirectme=1 would redirect to http://example.com/newpage while also: http://example.com/randompage/rtandomsirectory?redirectme=1 would also redirect to http://example.com/newpage I am sure there must be 2-3 lines I can put in the htaccess to do this but it is not working. This is a wordpress site if that should make a difference. Here is what I have tried: RewriteCond %{REQUEST_URI} ^/(.+) RewriteCond %{QUERY_STRING} ^redirectme=1$ RewriteRule ^/?$ http://example.com/? [R=301,L] and RewriteCond %{REQUEST_URI} ^/(.+) RewriteCond %{QUERY_STRING} ^redirectme=1$ RewriteRule (.*) http://example.com/? [R=301,L] different variations: Rewrite...