I am using customizr theme, I want to show both a logo and a title in header part. but I can show only one item at a time. as per this documentation http://www.themesandco.com/customizr/ theme set title if there is no logo. I want to show both, is there any way for this ? I want to show logo and on left side a company name. plz help
you can use a the *__after_logo* hook with the following code. (to copy and paste in your functions.php file of your child theme or your theme).
add_action( '__after_logo' , 'display_my_site_title');
function display_my_site_title() {
//first checks if there is a logo uploaded
$logo_src = esc_url ( tc__f( '__get_option' , 'tc_logo_upload') ) ;
if ( empty($logo_src) )
return;
//then print the site title after
printf('<h1><a class="site-title" href="%1$s" title="%2$s | %3$s">%4$s</a></h1>',
esc_url( home_url( '/' ) ),
esc_attr( get_bloginfo( 'name') ),
esc_attr( get_bloginfo( 'description' ) ),
esc_attr( get_bloginfo( 'name') )
);
}
The code has been tested and works. (you have to have at least v3.0.14 of the theme)
I hope this will be useful.
You will need to adjust the following file:
customizr\parts\class-header-header_main.php
You're right that it will show the title or the logo, as per comment in the file:
LINE 115 The template for displaying the title or the logo
Related
After updating plugins, my "Read more" button on posts changed it's name. In Latvian language it was "Lasīt vairāk", while in Russian "Читать дальше". It's just in plain English. The image of how it looks now is via this link. Plugin updates basically wiped out the padding and the name of the button.
Tried modifying functions.php with
// Replaces the excerpt "Read More" text by a link
function modify_read_more_link() {
return '<a class="read-article" href="' . get_permalink() . '">Your Read
More Link Text</a>';
}
add_filter( 'the_content_more_link', 'modify_read_more_link' );
// Replaces the excerpt "Read More" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="read-article" href="'. get_permalink($post->ID) . '">
Read the full article...</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
Tried loco translate and modifying internal translations of Elementor-related plugins. The closest I could get is that the elements is named "eael-post-elements-readmore-btn". Styling the element with CSS doesn't do anything. Padding or margin do not work. It's locked. Can anyone provide a hint?
The button should be in Latvian and Russian language, not in English.
PS. Figured that it is Elementor posts plugin related overriding functions.php and translators as well. At this moment, can't figure how to CSS this thing. Stays static.
Add this in functions.php:
function develop_custom_excerpt_more($more) {
global $post;
// edit here if you like
return '... <a class="excerpt-read-more" href="'. get_permalink( $post->ID ) . '" title="'. __( 'Read ', 'domain_name' ) . esc_attr( get_the_title( $post->ID ) ).'">'. __( 'Show more »', 'domain_name' ) .'</a>';
}
add_filter( 'excerpt_more', 'develop_custom_excerpt_more' );
Figured that it is Elementor posts plugin related overriding functions.php and translators as well. The eael-post-elements-readmore-btn was not changing in padding nor in margin because line-height which by default is set to 1 could not allow space for expansion.
Is it possible to change that behavior on the first time the visitor visit the product page to show the real featured image and only on select variant it will show the image without removing pre-selected variant?
When clicking the product in the listing (with a featured image) the product displays just an image, with the description and stuff, but a different image, not the featured.
I found this but the code is outdated: Same question and answer
My single/product-image.php template:
<div class="product-images relative mb-half has-hover <?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $wrapper_classes ) ) ); ?>" data-columns="<?php echo esc_attr( $columns ); ?>">
<?php do_action('flatsome_sale_flash'); ?>
<div class="image-tools absolute top show-on-hover right z-3">
<?php do_action('flatsome_product_image_tools_top'); ?>
</div>
<figure class="woocommerce-product-gallery__wrapper <?php echo implode(' ', $slider_classes); ?>"
data-flickity-options='{
"cellAlign": "center",
"wrapAround": true,
"autoPlay": false,
"prevNextButtons":true,
"adaptiveHeight": true,
"imagesLoaded": true,
"lazyLoad": 1,
"dragThreshold" : 15,
"pageDots": false,
"rightToLeft": <?php echo $rtl; ?>
}'>
<?php
if ( $product->get_image_id() ) {
$html = flatsome_wc_get_gallery_image_html( $post_thumbnail_id, true );
} else {
$html = '<div class="woocommerce-product-gallery__image--placeholder">';
$html .= sprintf( '<img src="%s" alt="%s" class="wp-post-image" />', esc_url( wc_placeholder_img_src( 'woocommerce_single' ) ), esc_html__( 'Awaiting product image', 'woocommerce' ) );
$html .= '</div>';
}
echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ); // phpcs:disable WordPress.XSS.EscapeOutput.OutputNotEscaped
do_action( 'woocommerce_product_thumbnails' );
?>
</figure>
<div class="image-tools absolute bottom left z-3">
<?php do_action('flatsome_product_image_tools_bottom'); ?>
</div>
</div>
Well, I 'v figured out how to stop this behavior. after 6 hours of search in the code in theme + WooCommerece plugin code, I found the solution.
1.First copy the file wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js
To your child theme /woocommerce/js/ folder if not have that folder create one.
2.Paste this at your theme child to call the new file and deregister the default file by woo:
add_action('wp_enqueue_scripts', 'override_woo_frontend_scripts');
function override_woo_frontend_scripts() {
wp_deregister_script('wc-add-to-cart-variation');
wp_enqueue_script('wc-add-to-cart-variation', get_stylesheet_directory_uri() . '/woocommerce/js/add-to-cart-variation.min.js', array('jquery', 'wp-util', 'jquery-blockui'), null, true);
}
3.Open the new copied file from your child theme and seatch for line 45 and Comment the following line:
setTimeout( function() {
//$form.trigger( 'check_variations' ); Comment this line to disable auto slide on first page load to the selected variation image
$form.trigger( 'wc_variation_form' );
self.loading = false;
}, 100 );
Copy the entire file you have just edited into some online js minify.
Paste the minified code inside the new file you have just created and rename the file to add-to-cart-variation.min.js.
Done, fixed the problem, the only issue with this can be on the next woocommerce updates if would they do to that file you may miss important updates.
Thanks, good luck
I had the same problem and solved it a slight different way, without needing to edit core WooCommerce js files.
The entire flex slider nav system of selecting the variation image depends on the class 'flex-control-nav' in file add-to-cart-variation.min.js line 650, "$gallery_nav = $product.find( '.flex-control-nav' )".
If the class flex-control-nav is not preset on page load, then the WooCommerce js cannot automatically select the default variation image.
So, when your page loads, make sure that the class flex-control-nav is not present in your thumbnail slider div - use a different class for styling the flexslider. I used a custom product_image.php template for this.
Set a js timer for 300 ms to run once the page loads, and once the timer fires, use js to add the class flex-control-nav into the slider div. You now have image sync between your variation images and main image gallery.
I have a wordpress website and used plugin called 'WooCommerce Product Subtitle' to add text under the title.
But the input didn't allow html tags.
How can I make that input allow html tags?
TO make input allow html tags, I have done with one line of code in plugin file.
see this screenshot: https://www.screencast.com/t/AUGvfS8lyRg
Path : wp-content\plugins\wc-product-subtitle\includes\class-admin-handler.php
Line No : 58
****just replace below line with line no 58:****
Before
update_post_meta( $post_id, WCPS_DB.'subtitle', wp_kses( $_POST['product_subtitle'],array() ) );
After
update_post_meta( $post_id, WCPS_DB.'subtitle', wp_kses_post( $_POST['product_subtitle'],array() ) );
Hop this works for you.
Updated code:
Edit single product template and display the field's value
<?php
global $post;
$subtitle = get_post_meta( $post->ID, 'wc_ps_subtitle', true );
echo '<div style="font-size:26px;">'.$subtitle.'</div>';
?>
You can get subtitle from above code and manage HTML tag also.
Hop this works for you.
My client is using the Divi builder theme and has asked me to insert a subhead under the post title on category archive pages. The theme uses the_content() to pull all content into the pages so simply adding a line under the title in the page templates isn't an option.
This may not be the best way to do it, but I used ACF to add get_field( "region" ) and modified the code from this github. It's inserting the field where I need it, but the title is reading html as text. I have a <br/> in there now but would like to replace with <span class="">. Any idea why it's not being read as code?
live example >
Code:
function gp121028_filter_title( $title ) {
$substrings = explode( ' | ', $title );
$title = ( ! empty( $substrings[0] ) ) ? $substrings[0] . '<br/>' . get_field( "region" ) : $title;
return $title;
}
Wasnt able to solve it - built it manualy.
If the wordpress widget title is blank or empty, then don't display the $before_title and $after_title wrapping the title.
Right now if the title is empty, you can end up with . If there are margins set for h2.widgettitle then you end up with blank space.
In reality, $before_title and $after_title shouldn't show up at all if there is no widget title.
I can work around it by changing the CSS #mytheme .widgettitle style, but one shouldn't have to change the stylesheet based on content.
The following should help get rid of the space. I am not too sure if this will work, but try adding it to your functions.php instead of your widget file to apply to all your widgets.
function custom_widget_title($title) {
$title = trim($title);
return $title;
}
add_filter('widget_title', 'custom_widget_title');
If you have created a widget, then replace the lines in your widget() method that shows the Title with the following code.
$title = apply_filters( 'widget_title', $instance['title'] );
if ( ! empty( $title ) ) {
echo $args['before_title'] . $title . $args['after_title'];
}
If you want to modify the title for existing/default widgets, then I would recommend you to define your custom widgets that extend the existing widgets.