[Support request] Remove sidebar and categories section in /directory

Home Forums Support [Support request] Remove sidebar and categories section in /directory

Home Forums Support Remove sidebar and categories section in /directory

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1343135
    Carlos

    Hello,

    I’m using the generatepress on a directory/biblia

    There’s any code CSS for to remove the section categories and the sidebar?

    Thank you very much!

    #1343338
    David
    Staff
    Customer Support

    Hi there,

    you can use the Layout Metabox module to remove sidebars from individual pages:

    https://docs.generatepress.com/article/layout-metabox-overview/

    This can also be set dynamically using the Layout Element:

    https://docs.generatepress.com/article/layout-element-overview/

    #1343515
    Carlos

    David,

    it’s not working! The directory /biblia is not WordPress because I can’t use elements, I need to use the file style.css in my directory.

    Do you understand now?

    Please go to my directory web and look the elements that I need remove. Example: (logo above, I have 2 logos) 2 Widgets: Categories + form register= Sidebar

    Any idea please?

    Thank you very much!

    #1343775
    Leo
    Staff
    Customer Support

    Sorry I don’t quite understand the issue either.

    What are you trying to accomplish?

    I noticed that the page doesn’t have page ID so we can’t just target the CSS to that page.

    #1344369
    Carlos

    Leo,

    I only need know how remove the right sidebar with CSS. The directory take the theme (Generatepress) for show html pages.

    Before the use generatepress my code worked very well with my old Newspaper theme. After I switch to Generatepress this directory /biblia is not working properly.

    For example, before it showed the description: “Biblia DC Online – Devocionales Cristianos” in all the pages the directory. Today shows only the title of the main page: “Devocionales Cristianos”

    This causes me a BIG problem with google, because all the descriptions on the page are repeated.

    I don’t know what I’m doing wrong! Look the code in the child theme

    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    add_action( 'wp_head', 'child_theme_head_script'); 
    function wpse62415_filter_wp_title( $title ) {
        $url = parse_url("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
                   
            foreach ($url as $key => $value) {
                if(preg_match("/^\/biblia/", $value)) {
                    $after 		= ' - Biblia DC Online';
                    $result 	= [];
                    $result2 	= [];
                    $result3 	= [];
    
                    $filepath = $_SERVER['DOCUMENT_ROOT'].$url['path'];
                    
                            if (file_exists($filepath)) {
                              $file = file_get_contents($filepath);
                              preg_match("/<h2[^>]+>(.+?)<\/h2>/", $file, $result);
                              
                              if(isset($result[1])) {
                                 $title = $result[1].$after;
                              } else {
                                    $file = file_get_contents($filepath);
                                    preg_match("/<h2>(.+?)<\/h2>/", $file, $result2);
                                    if(isset($result2[1])) {
                                        $title = $result2[1].$after;
                                } else {
                                    $file = htmlspecialchars(file_get_contents($filepath));
                                            preg_match("/<h2>(.+?)<\/h2>/", $file, $result3);
                                            if(isset($result3[1])){
                                                $title = $result3[1].$after;}
                                        else{
                                            $title = 'Biblia DC Online - Devocionales ✝ Cristianos';}
                                }
                              }
                            }
                }
            }
        return $title;
    }
    add_filter( 'wp_title', 'wpse62415_filter_wp_title',100 );
    
    /*  ----------------------------------------------------------------------------
        add the parent style + style.css from this folder
     */
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 11);
    function theme_enqueue_styles() {
        wp_enqueue_style('td-theme', get_template_directory_uri() . '/style.css', '', TD_THEME_VERSION, 'all' );
        wp_enqueue_style('td-theme-child', get_stylesheet_directory_uri() . '/style.css', array('td-theme'), TD_THEME_VERSION . 'c', 'all' );
    
    }
    
    //add_action( 'wp_head', 'child_theme_head_script'); 
    
    	add_filter('pre_get_document_title', 'change_the_title');
    	function change_the_title($title) {
    		$url = parse_url("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
                    
    		foreach ($url as $key => $value) {
    		    if(preg_match("/^\/biblia/", $value)) {
    		     	$after 		= ' - Biblia DC Online';
    		     	$result 	= [];
    		     	$result2 	= [];
    		     	$result3 	= [];
    
    		     	$filepath = $_SERVER['DOCUMENT_ROOT'].$url['path'];
    				if (file_exists($filepath)) {
    				  $file = file_get_contents($filepath);
    				  preg_match("/<h2[^>]+>(.+?)<\/h2>/", $file, $result);
    				  if(isset($result[1])) {
    				    return $result[1].$after;
    				  } else {
    				  	$file = file_get_contents($filepath);
    				  	preg_match("/<h2>(.+?)<\/h2>/", $file, $result2);
    				  	if(isset($result2[1])) {
    			    		return $result2[1].$after;
    				    } else {
    				    	$file = htmlspecialchars(file_get_contents($filepath));
    					  	preg_match("/<h2>(.+?)<\/h2>/", $file, $result3);
    					  	if(isset($result3[1]))
    					    	return $result3[1].$after;
    					    else
    					    	return 'Biblia DC Online';
    				    }
    				  }
    				}
    		    }
    		}
    	    return $title;
    	}
    
    function theme_slug_logo_url() {
        return 'https://www.devocionalescristianos.org';
    }
    
    add_filter( 'login_headerurl', 'theme_slug_logo_url' );
    
    function theme_slug_login_logo() { ?>
        <style type="text/css">
            #login h1 a, .login h1 a {
                background-image: url(https://www.devocionalescristianos.org/wp-content/uploads/2019/01/Logo_DC_ultimo_2019-2.png);
                height:75px;
                width:320px;
                background-repeat: no-repeat;
                padding-bottom: 20px;
                background-size: 320px;
            }
        </style>
    <?php }

    Please give me a light in the dark! I am having big problems with repeated content. Some help will be very welcome

    And for remove the right side I add the Generatepress child this code that not work! the code here:

    I’m trying:

    .right-sidebar {
           display:none;
    }       

    and for the remove the image:

    .header-imgage {
        max-width: 100%;
        height: auto;
        -ms-interpolation-mode: bicubic;
        display:none;
        vertical-align: middle;
    }

    But it’s not working.

    Any idea? Thank very much!

    #1344639
    Leo
    Staff
    Customer Support

    right-sidebar is not a class in GP.

    Try #right-sidebar as a selector instead.

    header-imgage is also not a class in GP.

    Try .header-image instead.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.