Genesis child theme - Remove primary sidebar on homepage only - wordpress

I have been looking all over the place and am unable to find a solution. I am using Genesis Child theme "news" and for the homepage I don't need the primary sidebar, because I'll have an image slider there instead. I have found code such as this:
/** Force full width layout */
add_filter( 'genesis_pre_get_option_site_layout', 'child_do_layout' );
function child_do_layout( $opt ) {
$opt = 'full-width-content'; // You can change this to any Genesis layout below
return $opt;
}
and added it to the functions page, because I want to essentially force a full width page for home.php, however it hasn't worked.
If anyone has had success with this, any help is appreciated.

nevermind, I found the solution to anyone who is curious, to the home.php file add:
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

Related

How to remove menu item from WordPress admin bar menu?

i want to remove an menu item from admin bar , tried the following code
add_action( 'admin_menu', 'remove_admin_menu_items', 999 );
function remove_admin_menu_items() {
remove_menu_page('admin.php?page=litespeed&LSCWP_CTRL=purge&LSCWP_NONCE=ccd23d492e&litespeed_type=purge_all_lscache' );
}
unfortunately it doesn't work ! I have attached a screenshot of menu I want to remove
I like to hide the menu using the child theme function.php code.
Plugin author posts the following:
The best way to hide our menu is by CSS. For top icon in adminbar, use
.litespeed-top-toolbar {display:none}. It can be done by using 3rd party plugin like https://wordpress.org/plugins/add-admin-css/ or
add_action('admin_head', 'hide_litespeed_icon');
function hide_litespeed_icon() {
echo '<style>.litespeed-top-toolbar {display:none}</style>';
}
into your theme’s functions.php
Alternatively, try adding the following code to functions.php:
function remove_lscwp_admin_menu($wp_admin_bar) {
$wp_admin_bar->remove_node('litespeed-menu');
}
add_action('admin_bar_menu', 'remove_lscwp_admin_menu', 999);

How to add a class to body element if it's a frontpage in WordPress?

last days I have been writing my own WordPress theme, but I run into another problem. These times I have no clue, how to make it possible.
I would like to add a class to every frontpage on my website. So if a single page becomes a frontpage, it will get another class to body tag like "home".
Almost every premium theme gots this funcion, but I just cant find the solution.
Does anybody have any idea?
Thank you! Stepan
You can add the class in body tag using body_class filter as shown below:
function home_body_class($classes) {
if ( is_front_page() ) {
$classes[] = 'home';
}
return $classes;
}
add_filter( 'body_class', 'home_body_class' );
You can manipulate the condition for the static homepage, blog page and so on.

Add real="pretyphoto" to wordpress gallery image

I m already using Pretyphoto script in my theme to open the featured images in a nice lightbox.
And now I would like to add rel="pretyphoto" to the wordpress gallery image
I can't do it manually because I will need to edit the media.php core file
So I would like to use a function that will do the job.
I already found solution for comments here :
function add_nofollow_to_comments_popup_link() {
return ' rel="nofollow" ';
}
add_filter( 'comments_popup_link_attributes', 'add_nofollow_to_comments_popup_link' );
So I would need something similar for the gallery image of wordpress.
Thanks
Found answer myself :
Here is the Solution for anyone who is interested.
Add this code in your theme functions.php
add_filter( 'wp_get_attachment_link', 'sant_prettyadd');
function sant_prettyadd ($content) {
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$content,1);
return $content;
}
And the gallery attachement must be MEDIA FILE

WP Elegant Themes > hide tinymce buttons?

I have an elegant theme installed in my Wordpress website, and I am wondering how i can hide or remove the shortcode buttons in the tinymce (thing) that are generated by the Elegant Theme (admin area WP). I have been trying to look up the action hook and remove it and also play with the CSS of the buttons, but nothing helped. any idea's on how to remove these small buttons from the backend of my WP website?
This is the related code I've found:
add_filter('mce_buttons', 'et_filter_mce_button');
add_filter('mce_external_plugins', 'et_filter_mce_plugin');
function et_filter_mce_button($buttons) {
array_push( $buttons, '|', 'et_learn_more', 'et_box', 'et_button', 'et_tabs', 'et_author' );
return $buttons;
}
Create a plugin and remove the filters:
<?php
/**
* Plugin Name: Remove ET MCE Buttons
*/
add_action( 'admin_init', 'remove_et_so_19084867' );
function remove_et_so_19084867() {
remove_filter( 'mce_buttons', 'et_filter_mce_button' );
remove_filter( 'mce_external_plugins', 'et_filter_mce_plugin' );
}
A user from the Elegant Themes forum referenced this post: https://wordpress.stackexchange.com/questions/103347/removing-buttons-from-the-editor and said:
Place the following code in your child theme functions.php:
// HIDE TINYMCE CUSTOM BUTTONS
function tinymce_editor_buttons($buttons) {
return array();
}
function tinymce_editor_buttons_second_row($buttons) {
return array();
}
add_filter("mce_buttons", "tinymce_editor_buttons", 99);
add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99);
This removes all buttons inserted by Divi and other plugins. If you need to keep any buttons you can include the corresponding ID inside of return array();. Also, if you're using the plugin TinyMCE Advanced, the standard buttons stay in place anyway.

How to disable a sidebar in wordpress

I am using a wordpress theme with two sidebars. I want to disable one for them for a specific page but the code I found regarding disabling sidebar by applying check on function:
<?php get_sidebar() ?>
It will disable both of them. How can I disable one of them only. with the other sidebar working.
Please help!!!!
You can simply for example
<?php if (!is_page('about-me')) get_sidebar(); ?>
This will disable sidebar on about me page. If you put this on page.php (if have any) otherwise put this on index.php. Here 'about-me' is page slug but you can also use page id like is_page(5) and as well as page title too. To check multiple page using slug, id and title you can use an array like
is_page(array(42,'about-me','Contact'));
For more about is_page() function see http://codex.wordpress.org/Function_Reference/is_page
Or using filter in functions.php, simply put this in functions.php
function disable_footer_widgets( $sidebars_widgets )
{
if (is_single())
{
$sidebars_widgets['footer'] = false;
}
return $sidebars_widgets;
}
add_filter( 'sidebars_widgets', 'disable_footer_widgets' );
This is just an example, you have to change widget name.

Resources