I am trying to remove the 'woocommerce-order-downloads' div in the admin menu from the 'shop_order' context. I got a great answer to identify the context and was able to remove the 'postcustom' div with the following code. Note that I'm trying to the exact same thing by including a line to remove 'woocommerce-order-downloads' as well. That piece is not working. I've tried 'order-downloads', 'downloads', etc. I also went to Settings --> Account --> Blanked our 'downloads' route. This seems odd but I'm relatively new. Any ideas how to remove this pesky div? I'm also trying to remove the order_label div as well... As you can see :)
function remove_custom_field_meta_box()
{
remove_meta_box('postcustom', 'shop_order', 'normal', 90);
remove_meta_box('woocommerce-order-downloads', 'shop_order', 'normal', 90);
//remove_meta_box('woocommerce-order-label', 'shop_order', 'normal');
}
//Remove postcustom/downloads/shippinglabel meta boxes
add_action('admin_menu', 'remove_custom_field_meta_box');
Try this instead:
add_action( 'add_meta_boxes', 'remove_shop_order_meta_boxe', 90 );
function remove_shop_order_meta_boxe() {
remove_meta_box('postcustom', 'shop_order', 'normal');
remove_meta_box('woocommerce-order-downloads', 'shop_order', 'normal');
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
Related
I try to add a custom link with ACF plugin... The modified php file with my ACF fields inside is finished but Im not able to override the original module.
function override_parent() {
remove_shortcode( 'et_pb_fullwidth_portfolio', 'et_pb_fullwidth_portfolio' );
add_shortcode( 'et_pb_fullwidth_portfolio', 'et_pb_fullwidth_portfolio_custom' );
}
add_action('after_setup_theme','override_parent');
// Replacing the existing filterable portfolio with new customised version
function et_pb_fullwidth_portfolio_custom() {
get_template_part( 'custom-modules/FilterablePortfolio' );
$wph = new Custom_ET_Builder_Module_Filterable_Portfolio();
}
add_action( 'wp', 'et_pb_fullwidth_portfolio_custom', 99 );
In my child theme i add a file with modified module.
Can anyone help?
I have "post-format" .php file in theme. (templates/blog/). I want to change some thing in this file so that need to add this in child theme.
In child theme, I created folder (templates/blog/) and then paste file. As per my research, I added below code in child theme function.php. Function called proper. but when I run it always take post-format.php file from parent theme instead of child theme.
add_action( 'after_setup_theme', 'setup_postformats', 10);
//add_action( 'after_setup_theme', 'setup_postformats', 20);
//add_action( 'after_setup_theme', 'setup_postformats', 11);
function setup_postformats(){
remove_theme_support('post-formats');
add_theme_support('post-formats', array(
'aside',
'chat',
'gallery',
'image',
'link',
'quote',
'status',
'video',
'audio'
));
}
Theme Name - Lincoln
Can anyone help me out?
I think you need to add the code for include the post-format.php in child theme functions.php file. So it will take the child theme version of post-format.php.
Hope this will solve your issue.
Thanks and Regards
It's important to set the priority for your after_setup_theme higher than your parent theme. The default priority is 10. Using the twentysixteen as example, use priority 11 on child themes. 'after_setup_theme' action. Please refer to the below example:
function twentysixteen_child_setup() {
add_theme_support( 'post-formats', array(
'video',
) );
}
add_action( 'after_setup_theme', 'twentysixteen_child_setup', 11 );
Update
// in your Child Theme's functions.php
// Use the after_setup_theme hook with a priority of 11 to load after the
// parent theme, which will fire on the default priority of 10
add_action( 'after_setup_theme', 'remove_post_formats', 11 );
function remove_post_formats() {
remove_theme_support( 'post-formats' );
add_theme_support( 'post-formats', array( 'video' ) );
}
I am developing a WordPress theme.
Core WordPress allow only Div and Nav tags in wp_nav_menu_container_allowedtags.
i want to add one more tag Select.
I have added filter in my functions.php
apply_filters ( 'wp_nav_menu_container_allowedtags', array( 'select', 'div', 'nav' ) );
But it is not working.
What is correct way to tell WordPress about new allow tags?
You need to use add filter to add your tag:
add filter in function.php of current active theme
function add_allowed_tags( $allowed ) {
array_push($allowed, 'select');
//print_r($allowed);exit;
return $allowed;
}
add_filter( 'wp_nav_menu_container_allowedtags', 'add_allowed_tags' );
I am using Woocommerce 2.4.4 and Wordpress 4,3, I have read many suggestions for making changes to woocommerce shop page; however I cannot find anyone who addresses my specific request. I have limited understanding of Woocommerce; however I have been trying to solve my request, but to no avail.
I want to display the wordpress caption field for each image in the wordpress media library in my woocommerce shop page but not on the individual products.
I have made changes to my child theme, Deli (A woocommerce theme) functions.php . I added the following to the child functions.php.
function wp_get_attachment( $attachment_id ) {
$attachment = get_post( $attachment_id );
return array(
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt',
true ),
**'caption' => $attachment->post_excerpt,**
'description' => $attachment->post_content,
'href' => get_permalink( $attachment->ID ),
'src' => $attachment->guid,
'title' => $attachment->post_title
);
}
I believe the field that has the image caption is 'caption' => $attachment->post_excerpt, as defined above.
I am trying to edit the Woocommerce Archive-product.php but do not know what to add or where to add it in the archive-product.php.
Hey as per your requirement have tried a code which might help you in your case or you can customize it further as per your request.
Add the following code to your Theme's functions.php.
Note: Its better to create a child theme first and do your customization in it so that the customization won't get overwritten when the theme updates.
add_filter( 'wp_get_attachment_image_attributes','wdm_shop_image_caption_func', 10,3 );
function wdm_shop_image_caption_func($attr, $attachment, $size){
if($size=='shop_single'){
unset($attr['title']);
}
elseif($size=='shop_catalog'){
$attr['title']=$attr['alt'];
}
return $attr;
}
Make sure that you set Caption for every Product's Images.
I was having problems with functions in the Aaron child theme in WordPress. I had part of my problem answered in Overwrite parent functions in child function.php WordPress but I couldn't get the logo to work as a bigger size. I eliminated a lot of code in order to narrow down and find the problem. And what I found is that the function in child theme wasn't showing up in WordPress. This is the function:
/* Site Logo */
function add_site_icon_support() {
$args = array(
'header-text' => array(
'Site Title Here',
'Your site description goes here.',
),
'size' => 'medium',
);
add_theme_support( 'site-logo', $args );
}
add_action( 'after_setup_theme', 'add_site_icon_support' );
I tested it out by adding it to the functions.php in parent theme and it works. Therefore, I was wondering how to make it work in the child theme?
Does it have something to do with this function in parent theme?
function aaron_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on aaron, use a find and replace
* to change 'aaron' to the name of your theme in all the template files
*/
load_theme_textdomain('aaron', get_template_directory() . '/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
add_theme_support('woocommerce');
add_theme_support('jetpack-responsive-videos');
add_editor_style();
add_theme_support('post-thumbnails');
add_image_size('aaron-featured-posts-thumb', 360, 300);
add_theme_support('title-tag');
register_nav_menus(array(
'header' => __('Primary Menu', 'aaron'),
'social' => __('Social Menu', 'aaron'),
));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
}
endif; // aaron_setup
add_action('after_setup_theme', 'aaron_setup');
Since both have the same hooks.
You need to run your hook later than the parent theme. You need to remember, child theme load first, then parent theme.
To make your function work, you need a lower priority, which is a higher number. You can try
add_action( 'after_setup_theme', 'add_site_icon_support', 11 );