Remove 'Theme Options' Option Tree Wordpress - wordpress

I use the Options Tree. Just to use a Meta Box only. And I do not use his Theme Options.
In the picture below, how to throw Theme Options menu?
Is it possible?

Add the following code to your functions.php file:
function remove_ot_menu () {
remove_submenu_page( 'themes.php', 'ot-theme-options' );
}
add_action( 'admin_init', 'remove_ot_menu' );
This will remove the panel you want to remove.

/**
* Option Tree Files
* Including Files and setting up Option Tree
*
* #Since 1.0.0
* Version 1.0.0
*/
if(class_exists('OT_Loader' )):
//Filter for option tree settings
add_filter( 'ot_show_pages', '__return_false' );
add_filter( 'ot_show_new_layout', '__return_false' );
add_filter( 'ot_post_formats', '__return_true');
add_filter( 'ot_use_theme_options', '__return_false' ); //This filter removes theme options page.
endif;
The code above is helpful to remove custom Theme options page from Option Tree, make sure you add this in functions.php
This code is helpful for people who want to just use Metaboxes of OptionTree plugin not the Theme options.

Related

WooCommerce: how to disable image zoom?

In WooCommerce we want to disable the product image zoom on hover. I've seen multiple options to do it in the child theme, functions.php. But they all are not working.
The child theme function.php is working (has some other code in it that is working). It's also not working when I put it in the main theme function.php file.
I've tried:
add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' );
and
function remove_image_zoom_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );
and
add_filter( ‘woocommerce_single_product_zoom_options’, ‘custom_single_product_zoom_options’, 10, 3 );
function custom_single_product_zoom_options( $zoom_options ) {
// Disable zoom magnify:
$zoom_options[‘magnify’] = 0;
return $zoom_options;
}
Any more options?
All the given options don't work. The theme has a (hidden) builtin feature for this.
Thanks for the replies.

Remove the Sort by dropdown completely, in WooCommerce

I want to remove the Sort by dropdown completely, in my WooCommerce installation.
http://cswpstage.hostworks.net/product-category/memorabilia/signed-photos/
Thanks!
It depends on the theme that you're using. There are two approaches, CSS and PHP.
I see on your theme you have already hidden it via CSS using
.sort-param-order,
.sort-param-sort {
display: none;
}
If you want to hide it with PHP, you need to look for the action which adds it and remove that action. A search for woocommerce_catalog_ordering will generally return the action you're looking for.
Here is how you remove it via standard WooCommerce:
<?php
/**
* Remove sorting from WooCommerce.
*/
function thenga_remove_filtering() {
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
}
add_action( 'init', 'thenga_remove_filtering' );
And here is how you remove it from the Storefront theme:
<?php
/**
* Remove sorting from Storefront.
*/
function thenga_remove_filtering() {
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
}
add_action( 'init', 'thenga_remove_filtering' );

How to integrate option tree latest version 2.6.0 theme in child theme of twenty seventy theme

I am trying to Integrate option Tree plugin in my child theme of twenty seventeen but Its not not working.
bellow is the code after adding option tree in child theme.
// Integrate OptionTree
add_filter( 'OT_CHILD_THEME_MODE', '__return_true' );
/* Theme Options */
require_once( get_template_directory() . '/option-tree/ot-loader.php' );
// Hide Documentation Page
add_filter( 'ot_show_pages', '__return_false' );
add_filter( 'ot_show_new_layout', '__return_false' );
Put the option-tree directory in the root of your theme. For example, the server path would be /wp-content/themes/theme-name/option-tree/.
Add the following code to the beginning of your functions.php.
/**
* Required: set 'ot_theme_mode' filter to true.
*/
add_filter( 'ot_theme_mode', '__return_true' );
/**
* Required: include OptionTree.
*/
require( trailingslashit( get_template_directory() ) . 'option-tree/ot-loader.php' );

How to remove wp customize sections in genesis

Can one help me to remove the customizer section in genesis. i want to remove color section from the theme customizer in genesis.tried many code but now working. can anyone help me with code
add_action( 'customize_register', 'wpse8170_customize_register' );
function wpse8170_customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->remove_section('id-of-section');
}
I had trouble with this too, until I found this code. Just stick it in your functions.php
// Removing Genesis Sections from Customizer page
add_action( 'customize_register', 'gd_remove_customize_section', 20 );
function gd_remove_customize_section($wp_customize){
$wp_customize->remove_section( 'genesis_layout');
$wp_customize->remove_section( 'genesis_breadcrumbs');
$wp_customize->remove_section( 'genesis_comments');
$wp_customize->remove_section( 'genesis_archives');
}

WordPress remove admin menu item

Generally it's not a problem to remove wp-admin menu items, e.g:
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
remove_submenu_page( 'themes.php', 'theme-editor.php' );
}
However I'm currently struggling with the following page:
admin.php?page=wpml-string-translation/menu/string-translation.php
What's the best method to have this one removed?
I think you're add_action needs a numeric as a 3rd argument (a priority).
https://wordpress.stackexchange.com/questions/55581/how-can-i-remove-the-wp-menu-from-the-admin-bar
Example
If you have this add_action:
add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
To remove it, it needs a higher priority (11):
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Remove WP Menu From Tool Bar
*/
if ( ! function_exists( 't5_remove_wp_menu' ) )
{
// The action is added with a priority of 10, we take one step later.
add_action( 'init', 't5_remove_wp_menu', 11 );
/**
* Remove the WP menu action.
*/
function t5_remove_wp_menu()
{
is_admin_bar_showing() &&
remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
}
}
Based on the previous answers, here's the completed solution for both WPML user menus:
function remove_menu_items()
{
//removes the 'String Translation' menu item from editor's admin screen
if (defined('WPML_ST_FOLDER')){
remove_menu_page(WPML_ST_FOLDER.'/menu/string-translation.php');
}
//removes the 'Translation Interface' menu item from editor's admin screen
if (defined('WPML_TM_FOLDER')){
remove_menu_page(WPML_TM_FOLDER . '/menu/translations-queue.php');
}
}
add_action('admin_menu', 'remove_menu_items', 999);
This should work,
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
remove_submenu_page( 'admin.php?page=wpml-string-translation/menu/string-translation.php', 'admin.php?page=wpml-string-translation/menu/string-translation.php' );
}
The working solution:
function remove_menu_items()
{
//removes the String Translation menu item from editor's admin screen
if (defined('WPML_ST_FOLDER'))
remove_menu_page(WPML_ST_FOLDER.'/menu/string-translation.php');
}
add_action('admin_menu', 'remove_menu_items', 999);
It needs a higher priority from which it was created and to avoid any issues let's use the same WPML constant, which we can find on the file "wpml-string-translation-class.php" at the plugin folder, line 212 as of version 1.6.1 of the WPML String Transtation plugin.

Resources