Stefan Vasiljevic
Forum Replies Created
-
Hi @big00ballz,
That issue is happening recently with the GoDaddy hosting. To fix it, please add the following to your
.htaccess
file# BEGIN Line too long fix <IfModule mod_substitute.c> SubstituteMaxLineLength 10M </IfModule> # END Line too long fix
Forum: Plugins
In reply to: [WooCommerce] Move woocommerce variation price@bahram421 please try adding the following snippet to your
functions.php
This will move the price for variable products above the qty input and below the variation options
add_action( 'the_post', 'wdc_move_price_order', 99 ); function wdc_move_price_order(){ if(is_product()){ global $product; if($product->is_type( 'variable' )): remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); add_action( 'woocommerce_single_variation', 'woocommerce_template_single_price', 15 ); endif; } }
Forum: Plugins
In reply to: [WooCommerce] Fatal error : Uncaught Error: Class ‘WC_Order’ not foundHi @skonsh,
in some cases theme files are outdated. So just for testing purposes, can you please try to rename the folder
woocommerce
towoo-temp123
in your theme and see if it works.basically rename:
wp-content/themes/poco/woocommerce/
towp-content/themes/poco/woo-temp123/
Forum: Developing with WordPress
In reply to: Preg_match the_content() to pull out images?@oguruma If you’re on the single template you can access
post_content
from theglobal $post;
object.For example:
global $post; $collected_images = array(); $post_content = $post->post_content; $dom = new DOMDocument(); $dom->loadHTML(mb_convert_encoding($post_content, 'HTML-ENTITIES', 'UTF-8')); // load the HTML $xpath = new DOMXPath($dom); $nodes = $xpath->query('//img'); foreach ($nodes as $node) { $img_src = $node->getAttribute('src'); if($img_src){ $collected_images[] = $img_src; } } echo '<pre>'; var_dump($collected_images); echo '</pre>';
So the urls from the source attribute are now added to the
$collected_images
I hope this helps
Forum: Developing with WordPress
In reply to: Preg_match the_content() to pull out images?I’d use
DOMDocument()
and extract image nodes the$content
variable. You can even target them by class.So if you have the images already updated basically you need to get the image id, some themes add that id to the class attribute, some don’t. Basically you can either add those ids to img classes or even better as a data-attr and push everything found to an array.
If you don’t have the images uploaded, and have them on a separate URL, you should import them to WP with
wp_insert_attachment()
.So long story short, when you have the attachment ID you can get the url and the width & height attributes simply by passing the id to
wp_get_attachment_image_src()
P.S. DOMDocument can throw some notices for HTML5 elements such as header, footer, figure…
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Plugins
In reply to: [WooCommerce] Apple Pay domain verification failedHere is the full code:
add_action(‘wp_head’, ‘bks_head_social_tracking_code’); function bks_head_social_tracking_code() { // Check if its thank you page. if(is_wc_endpoint_url( ‘order-received’ )) { // Get order object. $order = wc_get_order(get_query_var(‘order-received’)); if($order): // added // Get total. $order_total = $order->get_total(); // Prepare. $output = ” <script> gtag(‘event’, ‘conversion’, { ‘send_to’: ‘AW-1043540229/3GEKCIvXwM0CEIXSzPED’, ‘value’: “. $order_total .”, // Use dynamically. ‘currency’: ‘USD’, ‘transaction_id’: ” }); </script>”; // echo. echo $output; endif; // added } }
Forum: Plugins
In reply to: [WooCommerce] Apple Pay domain verification failedI just added 2 lines:
if($order):
and
endif;
so just wrap the existing code with it starting from
// Get total.
Forum: Plugins
In reply to: [WooCommerce] Some Product Images Not WorkingI just checked your website, the good news is that everything is working as it should, but the images you uploaded are HUGE, for instance this image has 75MB, you should resize them to the width of let’s say 1920px and re-upload.
The reason why you don’t see them is because it simply takes time to download them. As a best practice your images shouldn’t be larger than 100kb per image.
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Plugins
In reply to: [WooCommerce] Apple Pay domain verification failedThat code is looking for a query string from the URL, for example yourwebsite.com/order-recieved/?order-received=orderID
but there is no fallback if the query string doesn’t exist.
so to fix it by bypassing the error, wrap it in a IF statement
if($order): // Get total. $order_total = $order->get_total(); // Prepare. $output = ” <script> gtag(‘event’, ‘conversion’, { ‘send_to’: ‘AW-1043540229/3GEKCIvXwM0CEIXSzPED’, ‘value’: “. $order_total .”, // Use dynamically. ‘currency’: ‘USD’, ‘transaction_id’: ” }); </script>”; // echo. echo $output; endif;
P.S. I don’t think this will fix your domain verification issue, this functionality is basically for pushing a conversion to gtag.
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Plugins
In reply to: [WooCommerce] Тhe settings for tumbnail doesn’t savedYou need to regenerate thumbnails after you make changes to the image sizes. By Default WordPress will fallback to the original image if there is no resized thumbnails available.
You can easily regenerate your thumbnails with this plugin Regenerate Thumbnails
Also, your original image must be larger than the set size, for example if you set the shop thumbnail to 300×300, the original image must at least be 300×300 or larger.
Forum: Plugins
In reply to: [WooCommerce] WooCommerce causing ERR_HTTP2_PROTOCOL_ERRORHi,
This seems like and issue with GoDaddy hosting. I saw a lot of similar issues reported for their hosting lately.
One possible fix is to add the following lines to your
.htaccess
file, but of you don’t know what are you doing, please ask for their support because any mistake in the.htaccess
file can cause your website to stop working with error 500# BEGIN Line too long fix <IfModule mod_substitute.c> SubstituteMaxLineLength 10M </IfModule> # END Line too long fix
- This reply was modified 3 years, 6 months ago by Stefan Vasiljevic.
Forum: Plugins
In reply to: [WooCommerce] Force Download Stops at 1024 MBHi,
this seems interesting.
I’d say the issue is because the PHP script is running in the background during download and exhausting PHP max execution time causing it to fail.
Can you try to increase the
max_execution_time
in your php.ini file and check the value ofmemory_limit
?Maybe that can help, but if it doesn’t we can rule out the possible server-side issue.
Forum: Fixing WordPress
In reply to: Comments go to an image file pageSo in WordPress attachment page (image page) is the separate content type from Pages, Posts. Each content type can have comments enabled or disabled.
I think that in your case someone commented on the attachment page instead of page and that caused the issue.
Because each content type entry has it’s own ID they are considered as different instances so the comments belong only to them.
The comment not appearing in dashboard may be caused by cache, for example you removed the page but it was cached on your daughters browser so she was able to see it and comment on it.
Can you try in a private/incognito window?
Forum: Fixing WordPress
In reply to: Comments go to an image file page@tommyshanks please take a look at video instruction.
Forum: Fixing WordPress
In reply to: Comments go to an image file page@tommyshanks I’m still here ??
So to try to understand you want the comment from attachment page aka image page to go to the parent post page, or you want to disable comments on the attachment pages?
By default, if the option Allow people to submit comments on new posts in Settings -> Discussion is checked it will automatically open comments on all entries on your website(pages, posts, media), and you have an option to manually override it.
Let me grab a few screenshots regarding the steps above