-
Author
-
April 24, 2018 at 12:37 #195891alexplex86Participant
Hello! How can I disable the page title in page.php? I tried setting $title_arr[‘show_title’] = true; to false but nothing happens.
I don’t want to use the CSS display: none
April 24, 2018 at 18:57 #195922RaduModeratorHi,
You want to remove completely page title ? from all pages/posts/cpt ? or in certain page ?
Did you had checked the page backend ? see the screenshot
Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 25, 2018 at 09:20 #195984alexplex86ParticipantSorry, I was being unclear. I’m editing another plugin and this plugin does not have any options for hiding the page title. So I took the PHP code from Kleos page and in that code I found some hooks. I was just wondering what hook I need to edit so that the title wont be displayed.
Attachments:
You must be logged in to view attached files.April 26, 2018 at 15:49 #196148RaduModeratorHi,
You will have to ask the plugin author for a conditional tag like this if_plugin_page() and if they have one you will have to use a code like this
COPY CODEadd_action( 'after_setup_theme', 'hide_the_tile_certain_places', 10 ); function hide_the_tile_certain_places() { //title section $title_arr['show_title'] = true; //hide breadcrumb? $title_arr['show_breadcrumb'] = false; }
wrap the add action in the plugin condition
Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 26, 2018 at 17:15 #196159RaduModeratorLet me know
btw what’s the plugin name ?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 26, 2018 at 17:47 #196163alexplex86ParticipantIt’s Modern Events Calendar. This plugin automatically generates an individual page for every event that is posted with its own elements that I didn’t want to use. I only wanted to display my own content on those pages. That was not possible without customizing the plugin. So I pasted the code from Kleos page.php into Modern Events Calendars single-mec-events.php and got what I wanted.
Except that Kleos page.php by default shows the title. And there was no option for disabling this title in the Modern Events Calendar admin panel.
So I looked around and found the $title_arr[‘show_title’] hook or function or snippet or whatever it is called and thought maybe if I pasted it inside single-mec-events.php and set it to false it might disable the title.
But that did nothing. So as of now I just used display:none. But I read somewhere that you should avoid using display:none as much as possible. But I don’t know why. Also, display:none disables the title on the whole site, even on pages where I do want to use titles.
I’m pretty new to coding and PHP so I might not know what I am doing 😛
April 26, 2018 at 19:05 #196177RaduModeratorHi,
Found a easy way just copy this file : wp-content/themes/kleo/page-parts/general-title-section.php to your child theme in wp-content/themes/kleo-child/page-parts/
Create the missing folders in child theme.
Then open from child theme wp-content/themes/kleo-child/page-parts/general-title-section.php and add the next code in the marked area starting from line 23-24
COPY CODE/*Hide the tittle on events pages*/ if(is_singular('post')){ $title_arr['show_title'] = false; //$title_arr['show_breadcrumb'] = false; //$title_arr['extra'] = ''; } /*END Hide the tittle on events pages*/
Replace post from the code with your post type slug.
It should be ok.
Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.