I want to remove the author name from wordpress blog posts . Also I dont want to delete the author name becoz I use different author names from admin side.
WP v4.1.2
Edit content-single.php:
Appearance->Editor->content-single.php
<div class="entry-meta">
<?php // twentyeleven_posted_on(); ?>
</div><!-- .entry-meta -->
Comment the middle line "twentyeleven_posted_on();" like above
Title line on post saying: Published By AUTHOR on DATE will not be displayed
OR (less recommended as it effects a wider scale)
functions.php
COMMENTED LINE get_the_author()
function twentyeleven_posted_on() {
printf( __( '<span class="sep">Posted on </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) )/*,
get_the_author()*/
);
}
Open the single.php file of your current theme through your ftp client or from Dashboard -->Appearance -->Editor
Delete this code :
<span class="meta_author"><?php the_author(); ?></span>
Hope this helps
You can comment/delete the line where author name is printed.
<span class="meta_author"><?php the_author(); ?></span>
I removed the author names from posts and search results on a site built with The7 theme by adding this custom CSS:
a.author.vcard {
display: none;
}
The other answers here that relate to the PHP code of WP are true, but alternatively this can also be done by modifying the CSS code of the site.
Under the main stylesheet file (style.css), you can add this definition:
.blog-title-body SPAN {
display:none !important;
}
This specifically will hide both the author name AND the category name under the header of the post page (the post name).
If you want to remove only the category name, for example, you can put in the following definition:
.blog-title-body SPAN.cat-links {
display:none !important;
}
NOTE:
be sure to always make a backup copy of every built-in file on WP site that you modify!!
It is also highly recommended to make an entire site backup periodically, with and without relation to modifications and changes.
Related
On a WordPress website I'm using BuddyBoss theme and I've added a glossary plugin.
I'm trying to add a Author Box to under each glossary term, to let site visitors visit the profile of its author. To do this, I've installed a plugin called PublishPress which almost does the job but by default the profile URLs leads to the person's author profile https://example.com/author/hisname/ which should be https://example.com/members/hisname/.
By googling I found a similar solution for another theme:
// FUNCTION
// Change Post's Author URL to Buddypress Profile URL
add_filter('generate_post_author_output','generate_post_author_output_buddyprss_url');
function generate_post_author_output_buddyprss_url( $post_author_profile_link ){
$post_author_profile_link = sprintf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
__( 'by','generatepress'),
esc_url( bp_core_get_user_domain( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'Know more about %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
) ;
return $post_author_profile_link;
}
I'm wondering how can I customize the script in order to do the exact job. To be honest I'm totally screwed up. Thanks for any help!
I fixed the issue by the pro version of the PublishPress Authors. In the pro version there's a possibility to edit the layout and there's a property returning the BuddyPress Profile Link.
<a href="{{ author.buddypress_profile_link }}"...
instead of:
<a href="{{ author.link }}"...
I'm currently using WooCommerce OnePage CheckOut
I'd like to remove the "attribute :" text from the product list.
I copied product-list.php
FROM: "/wp-content/plugins/woocommerce-one-page-checkout/templates/checkout/"
TO: "/public_html/wp-content/themes/my-theme-child/woocommerce/checkout/product-list.php"
Modified the "/public_html/wp-content/themes/my-theme-child/woocommerce/checkout/product-list.php" file
FROM:
<span class="attributes"><?php echo esc_html( apply_filters( 'woocommerce_attribute', $attribute_string, $product->get_variation_attributes(), $product ) ); ?></span>
TO:
<span class="attributes"><?php echo esc_html( apply_filters( 'woocommerce_attribute', str_replace ("attribute: ","",$attribute_string), $product->get_variation_attributes(), $product ) ); ?></span>
Once I saved the file, seems the changes not reflected on the page?
Did I miss anything here?
Thanks
It turns out to be caching issue sigh
All good now
Another option is to update /wp-content/themes/my-theme-child/functions.php
add_filter( 'woocommerce_attribute_label', 'remove_attribute_label');
function remove_attribute_label() {
return "";
}
But with this option, the colon still exists...
I'm using WooCommerce in Japanese and have just modified mail template 'customer-processing-order.php' to display the customer's full name instead of his/her first name.
//before
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
//after
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_formatted_billing_full_name() ) ); ?></p>
This works fine, but the sentence below this is not translated to Japanese any more.
//This sentence is not translated to Japanese
<p><?php printf( esc_html__( 'Just to let you know — we\'ve received your order #%s, and it is now being processed:', 'woocommerce' ), esc_html( $order->get_order_number() ) ); ?></p>
I'm keeping this part intact and before making any changes, this part was translated to Japanese without problem.
Other Sentences following this are still translated into Japanese.
I have problem with just this sentence "Just to let you know — we've received your order #%s, and it is now being processed:"
I'd like to know why and the solution for this.
Additional info:
I modified mail template in admin screen going to:
WooCommerce > Settings > Emails > Processing order > Manage Then I
clicked 'Copy file to theme' button, then modified on edit screen.
WordPress Version 5.5 WooCommerce Version 4.4.1
Thank you in advance.
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.
There are 3 authors in our company blog, each author has own site url in profile settings:
Mike - http://mike.com
Gelens - http://gelens.com
Admin - http://site.com/company/
the links for profiles are:
http://site.com/author/Mike/
http://site.com/author/Gelens/
http://site.com/author/Admin/
I need to replace a link to Admin's page, so, if there is <?php the_author_posts_link(); ?> tag on some page, and the author is Admin, the link must be http://site.com/company/ instead of http://site.com/author/Admin/.
How can I do that?
It looks like the the_author_posts_link function just calls get_author_posts_url to get the link, which passes the link through the author_link filter before returning it. In your theme's functions.php, you could add something like this (untested):
add_filter( 'author_link', 'admin_author_link', 10, 3);
function admin_author_link($link, $author_id, $author_nicename) {
if( $author_id==1 ) {
$link = 'http://site.com/company/';
}
return $link;
}
I think the least heartburn would be wordpress > the_author_meta.
Have each user add their url in the wordpress user profile, as you have done. Then in your theme's functions.php use the_author_meta('user_url'). Remember this will echo the url. To use it as a variable use get_the_author_meta('user_url').
Here is how we did it with the twenty ten theme, this is in functions.php
function twentyten_posted_on() {
printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
'meta-prep meta-prep-author',
sprintf( '<span class="entry-date">%3$s</span>',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
),
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
get_the_author_meta('user_url'), //changed from get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'About %s', 'twentyten' ), get_the_author() ),
get_the_author()
)
);
}
That's URL rewriting with .htaccess, which is possible by editing the .htaccess by hand.
But easier for a beginner with a plugin such as http://wordpress.org/extend/plugins/redirection/ which seems like it will do what you need.
You can do this using http rewrites.
I also needed author URL to a different page.
My site is on WordPress and I use oxygen.
I went to my blog page template where I entered the author which is selected dynamically.
there is an option to link the author's name to the archive page or the author's website.
I selected the author's website. Then went to the users on WordPress and went to the authors and added the page I wanted to actually go to as their website.