Tsakman
Forum Replies Created
-
Thank you for your answer. I asked Gemini AI and it gave me this code.I don’t know if its ok but I will try it and i will inform you
<?php
// User Submitted Posts - Core Functions
if (!defined('ABSPATH')) die();
function usp_auto_display_images($content) {
global $usp_options;
$enable = isset($usp_options['auto_display_images']) ? $usp_options['auto_display_images'] : 'disable';
if (usp_is_public_submission() && ($enable === 'before' || $enable === 'after')) {
$markup = isset($usp_options['auto_image_markup']) ? $usp_options['auto_image_markup'] : '';
$author = get_post_meta(get_the_ID(), 'user_submit_name', true);
$post_id = get_the_ID();
$categories = get_the_category($post_id);
$featured_image_set = false; // Flag to check if featured image was set
if ($categories) {
foreach ($categories as $category) {
// Check if category has a default featured image
$default_featured_image_url = get_category_meta($category->term_id, 'default_featured_image', true);
if ($default_featured_image_url && !$featured_image_set) {
// Set default featured image
$featured_image_id = usp_get_attachment_id_from_url($default_featured_image_url);
if ($featured_image_id) {
set_post_thumbnail($post_id, $featured_image_id);
$featured_image_set = true;
}
}
}
}
$args = array(
'post_type' => 'attachment',
'post_parent' => $post_id,
'numberposts' => -1,
);
$args = apply_filters('usp_image_args', $args);
$attachments = get_posts($args);
if ($attachments) {
// Display other images inside the article
$images = '<p>';
foreach ($attachments as $attachment) {
$title = apply_filters('usp_image_title', $attachment->post_title);
$thumb = apply_filters('usp_image_thumb', wp_get_attachment_image_src($attachment->ID, 'thumbnail', false));
$medium = apply_filters('usp_image_medium', wp_get_attachment_image_src($attachment->ID, 'medium', false));
$large = apply_filters('usp_image_large', wp_get_attachment_image_src($attachment->ID, 'large', false));
$full = apply_filters('usp_image_full', wp_get_attachment_image_src($attachment->ID, 'full', false));
$custom_size = apply_filters('usp_image_custom_size', 'custom');
$custom = apply_filters('usp_image_custom', wp_get_attachment_image_src($attachment->ID, $custom_size, false));
$parent_id = wp_get_post_parent_id($attachment->ID);
$parent_title = get_the_title($parent_id);
$url = apply_filters('usp_url_custom_field', get_post_meta(get_the_ID(), 'user_submit_url', true));
$images .= usp_replace_image_vars($markup, $title, $thumb, $medium, $large, $full, $custom, $parent_title, $author, $url);
}
$images .= '</p>';
if ($enable === 'before') $content = $images . $content;
elseif ($enable === 'after') $content = $content . $images;
}
}
return $content;
}
add_filter('the_content', 'usp_auto_display_images');
// Helper function to get attachment ID from URL
function usp_get_attachment_id_from_url($image_url) {
global $wpdb;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url));
if ($attachment) {
return $attachment[0];
}
return false;
}Forum: Plugins
In reply to: [WooCommerce] Wave empty link errorThe code is inside
wc-template-functions.phpand especially at line 1200echo '<a href="' . esc_url( $link ) . '" class="woocommerce-LoopProduct-link woocommerce-loop-product__link">';
How can i add something there not having an empty link?If i add a name it shows this
Warning: The use statement with non-compound name ‘AutomatticJetpackConstants’ has no effect in /home/tsakmang/pallismed.tsakman.gr/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 11
Fatal error: Uncaught Error: Class ‘Constants’ not found in /home/tsakmang/pallismed.tsakman.gr/wp-content/plugins/woocommerce/includes/wc-template-functions.php:282 Stack trace: #0 /home/tsakmang/pallismed.tsakman.gr/wp-includes/class-wp-hook.php(307): wc_generator_tag(‘<meta name=”gen…’, ‘xhtml’) #1 /home/tsakmang/pallismed.tsakman.gr/wp-includes/plugin.php(191): WP_Hook->apply_filters(‘<meta name=”gen…’, Array) #2 /home/tsakmang/pallismed.tsakman.gr/wp-includes/general-template.php(4796): apply_filters(‘get_the_generat…’, ‘<meta name=”gen…’, ‘xhtml’) #3 /home/tsakmang/pallismed.tsakman.gr/wp-includes/general-template.php(4708): get_the_generator(‘xhtml’) #4 /home/tsakmang/pallismed.tsakman.gr/wp-includes/general-template.php(4685): the_generator(‘xhtml’) #5 /home/tsakmang/pallismed.tsakman.gr/wp-includes/class-wp-hook.php(307): wp_generator(”) #6 /home/tsakmang/pallismed.tsakman.gr/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #7 /home/tsakmang/pallismed.tsakman.gr/wp-includes/plugin. in /home/tsakmang/pallismed.tsakman.gr/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 282The products are elementor category products
Can you help me edit the php?
Thank you for all- This reply was modified 3 years, 7 months ago by Tsakman.
- This reply was modified 3 years, 7 months ago by Tsakman.
- This reply was modified 3 years, 7 months ago by Tsakman.
- This reply was modified 3 years, 7 months ago by Tsakman.
- This reply was modified 3 years, 7 months ago by Tsakman.
- This reply was modified 3 years, 7 months ago by Tsakman.
Forum: Plugins
In reply to: [WooCommerce] Shop sidebar ceratin categoriesI’ve manage to do it,with hiding all the empty terms.
But how can i choose to hide all the empty terms at shop page and not to hide at other pages?
Thank you for all your helpForum: Plugins
In reply to: [WooCommerce] Shop sidebar ceratin categoriesThank you for your help.
Unfortunately i cant do it.When i am searching the products i can show them but the sidebar shows all the categories not the related categorieshttps://www.demo.tsakman.gr/?post_type=product&s=doodle for example
Forum: Plugins
In reply to: [WooCommerce] Shop sidebar ceratin categoriesI tested the woocommerce product filter.Is there someway to show the categories too?Not only the products.Is there any tutorial?
Thank you for allThank you for the answer.
Because the client’s site has to pass the validator to be approved ,can i do something? I know that he can use the plugin safely,but the company which checks the sites,wants no errors from the validator
Thank you for all and for your time!Forum: Plugins
In reply to: [WooCommerce] W3C errorsI fixed the max quantity and size=4 by add the max quantity and delete size 4 at the quantity-input.php but i dont fixed the rest.
Thank you.- This reply was modified 4 years, 8 months ago by Tsakman.
Forum: Plugins
In reply to: [WooCommerce] Woocommerce frequntly bought togetherThank you very much for all your help.
I search plugin for product addons and i found a solution.- This reply was modified 4 years, 10 months ago by Tsakman.
Forum: Plugins
In reply to: [WooCommerce] Woocommerce frequntly bought togetherThank you for all these and your help
But i think these are only by product editing one by one.
I want if its possible to create a bundle of products and show them in certain categories because i have lots of products.Thank you!!!
Forum: Plugins
In reply to: [SportsPress - Sports Club & League Manager] Players admin sidebar problemThank you very much.It was a plugin from the theme.i disable it and all works ok now.
Thank you very much.I didn’t see it.
Thank you!
All working good!Oh i see.I will find how to fix it.
Thank you for all.Than you very much.
Can you tell me if it is possible how can i do it please or where to look for this?- This reply was modified 7 years, 3 months ago by Tsakman.