I am having an issue with Gift Certificate Creator Plugin. After adding the shortcode [gift_certificate_form] on any post/page, we need to submit the form from the front end.
The details are also displayed in WordPress admin area.So when I checked from Gift certificate > settings. I am getting an unwanted toggle button near to username. I tried adding CSS, to hide but failed. So anyone please help me to find a solution for this.
You CSS doesn't work for admin dashboard if you written those in themes style.css.
You Need to write an add_action to functions.php.
And After I checked. I saw .toggle-row is the unwanted toggle button near to username Gift Certificate Creator. So Use Below Code in themes functions.php.
<?php
add_action('admin_head', 'my_css');
function my_css() {
echo '<style>
.toggle-row {
display: none;
}
</style>';
}
?>
Related
I have very beginner level understanding of wordpress, woocommerce and elementor. I am still learning a lot of things. I believe that the best way to learn is to imitate. So, I go through various themes and try to imitate their behaviour and appearance using Elementor. But, this particular theme caught my eye. The Add to cart button appears when someone hovers over the product image instead of always being there. Can you guys please help me figure this out or atleast point me in the right direction?
This is how it should look when someone hovers over the images
This is how it looks when the mouse pointer is away
More info
<?php if($available) {?>
Buy now
<?php } ?>
This code solves my problem as expected.
WooCommerce documentation reference
Solution: Add code in your theme's function.php file.
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );
function my_extra_button_on_product_page() {
global $product;
echo 'Add to cart';
}
Solution: Install Custom WooCommerce Add to Cart plugin
Custom WooCommerce Add to Cart Plugin
Solution: You can use hooks with shortcodes:
custom add to cart button
Or create overrides for WooCommerce files in your own template
I've tried a lot of things. No results.
My add to cart button for variable product does not work. it works for simple product. but for variable product, it is not even shown up.
I have edited the twenty-thirteen theme to incorporate my custom html theme and over ridden the css and everything else that existed.
When i change the theme to 2015/2014, it works fine. But with my custom theme, it doesnt work.
I have tried WooCommerce jQuery Cookie Fix
and added a hook to function.php as :
/*Add to Cart for variable products*/
function fix_woo_var_cart()
{
wp_enqueue_script('add-to-cart-variation', '/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js',array('jquery'),'1.0',true);
}
add_action('wp_enqueue_scripts','fix_woo_var_cart');
?>
Nothing however seems to work! Please help!
apparently id commented wp_head() and wp_footer(); for some reason.
i was told that isn't necessary while i learnt to integrate html into wp. therefore, the issues.
Uncommented that and all's fine.:)
I want to highlight author comments in admin panel of WordPress engine. I have many comments on my blog every day, and it's hard sometimes in admin panel to find my own comment.
This can be achieved with a targeted action hook and a bit of CSS:
add_action( 'admin_head-edit-comments.php', 'colored_comments_so_15232115' );
function colored_comments_so_15232115()
{
?>
<style>.comment-author-USER_LOGIN { background-color: #DFDB83 }</style>
<?php
}
Replace USER_LOGIN with your login name. And surely, you could add as many users/background-colors as needed.
This CSS is only printed in the Comments page (/wp-admin/edit-comments.php) by using the hook admin_head-$hook_suffix.
You can also use a plugin: Comment Moderation Highlights
note: I'm the plugin developer.
Set it so that it looks for your email addresss, pick a color and save. All your comments will be Highlighted within the comments admin.
I have a wp-network installed with users that can create pages in each site.
Each of those pages get a place in the primary menu, and only one user have permission to create all this menu.
I want to create a user only to be able to edit the content of the pages, but not the title.
How can I disable the title of the page to be edited from the admin menu for a specific user, or (far better) for a capability?
I thought only a possibility, that's editing admin css to hide the title textbox, but I have two problems:
I don't like to css-hide things.
I don't know where is the admin css.
I know php, but don't know how to add a css hide to an element for a capability.
You should definitely use CSS to hide the div#titlediv. You'll want the title to show in the markup so the form submission, validation, etc continues to operate smoothly.
Some elements you'll need to know to implement this solution:
current_user_can() is a boolean function that tests if the current logged in user has a capability or role.
You can add style in line via the admin_head action, or using wp_enqueue_style if you'd like to store it in a separate CSS file.
Here is a code snippet that will do the job, place it where you find fit, functions.php in your theme works. I'd put it inside a network activated plugin if you're using different themes in your network:
<?php
add_action('admin_head', 'maybe_modify_admin_css');
function maybe_modify_admin_css() {
if (current_user_can('specific_capability')) {
?>
<style>
div#titlediv {
display: none;
}
</style>
<?php
}
}
?>
I resolved the problem, just if someone comes here using a search engine, I post the solution.
Doing some research, I found the part of the code where the title textbox gets inserted, and I found a function to know if a user has a certain capability.
The file where the title textbox gets added is /wp-admin/edit-form-advanced.php. This is the line before the textbox
if ( post_type_supports($post_type, 'title') )
I changed it to this
if ( post_type_supports($post_type, 'title') and current_user_can('edit_title') )
That way, the textbox is only added when the user has the capability called "edit_title"
When this IF block ends few lines after, I added:
else echo "<h2>".esc_attr( htmlspecialchars( $post->post_title ) )."</h2>";
To see the page title but not to edit it, when the user hasn't got "edit_title" capability.
Then I had already installed a plugin to edit user capabilities and roles, wich help me to create a new capability (edit_title) and assign it to the role I want.
Hey people, I've been coming here for a while but just decided to join.
I'm new to php and I'm trying to make a website with WordPress as the CMS.
Anyway, I'm basically making my own theme because I don't want my website to look like a blog, and it's going pretty smoothly so far but theres this huge top margin gap in the browser even when I set margins to 0px.
I tried trial and error and found out that it's being caused by: <?php wp_head(); ?>
It's two different things.
1. wp_head() function
wp_head() is a template tag to print whatever plugin / theme specific function used by wordpress action. Read codex for more detail about it.
2. The admin bar
The top margin, is generated by wordpress's admin bar.
To fix this for logged in users you can do a couple of things:
Disable admin bar from the admin:
Go to admin panel
Users >> User Profile
Uncheck 'when viewing
site' on 'Show Admin Bar'
Remove the admin bar from your theme entirely:
Open your functions.php
Add this to it:
function my_function_admin_bar(){ return false; }
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
Remove only the code which creates the css:
Open your functions.php
Add this to it:
function my_filter_head() { remove_action('wp_head', '_admin_bar_bump_cb'); }
add_action('get_header', 'my_filter_head');
Note: Extensive updates are from #hitautodestruct
you neeed to call wp_footer() in your footer
just insert this line <?php wp_footer();?> into your footer.php file
If you have updated your wordpress install to the latest version.. there seems to be some bug with the admin bar...
were it would produce an inline stylesheet appended to the top of your pages.. causing the margin-top:28px
see here
1 recomendation is to put a new function into your functions.php file located in your theme folder.. this will completly remove the bar, so no users of your theme will have any of the same issues!
function my_function_admin_bar(){
return false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
Not sure if this will help.. but worth a shot.. also turning off the admin bar while viewing the front end of the site under your profile page..