• Hi,

    I have a category page which displays all my posts in a certain category. Now these posts have their titles hidden as for design purposes the titles are done with large images for each article.

    What I found out is that if every post has its title hidden then the category page also hides its title (and the subtitle which in my theme it gets from the category description)

    I asked the theme author and he said this is a limitation of WordPress and it gets its instruction to display the category from one of the posts and if you have the category hidden on all 10 posts (for example) then it will be hidden on the category page.

    I wondered if I could change any part of the wordpress code to force it to display the title and subtitle on the category page? Currently my work around is to add a dummy post with no content but its title not hidden, but its not really ideal.

Viewing 15 replies - 1 through 15 (of 16 total)
  • he said this is a limitation of WordPress

    Sorry but that just sounds like so much rubbish. The solution depends upon how these titles have been “hidden” – using CSS or via PHP in the templates.

    Thread Starter djdeejay

    (@djdeejay)

    I would imagine they are hidden by php as it was a custom post rule I was using he didn’t even want to be available on post types and has since removed. My answer to that was to rip the post and subtitle php out of the standard post template – which does the job for me.

    Problem then of course is I’m stuck with this. I don’t understand why the category page is even interested or looking at what the post titles are doing when it has its own post title and subtitle?

    Even if this has been “coded” by removing the necessary PHP from single.php, that doesn’t mean that the tiles can’t be displayed in the category pages via category.php. As I said, the exact solution will depend upon the implementation but I still think that this isn’t a WordPress limitation. It’s a theme/design one.

    Thread Starter djdeejay

    (@djdeejay)

    Well there is no category.php in the themes folded for a start off…

    If I create one will WordPress pick it up automatically or does the theme need to reference it somewhere else?

    If I create one will WordPress pick it up automatically

    Yes.

    Thread Starter djdeejay

    (@djdeejay)

    Ah ok, I don’t suppose there is an easy way to pull the category page WordPress creates by default into my category.php as a starting path is there (all I really need to do is add the title code to the top of it really…)

    That’s what WP does by default.

    Thread Starter djdeejay

    (@djdeejay)

    …except in my case here it isn’t as as soon as I remove the title php from all the posts in that specific category the title disappears from my category page as I’ve said.

    So what I need to do is recreate the default category.php must dynamically create when one doesn’t exist in the theme folder and force it to use its own title…

    Is there a category.php file in your theme?

    Thread Starter djdeejay

    (@djdeejay)

    I said there wasn’t one and asked if I created one would WordPress pick it up automatically and you answered me, just above…

    Ive copied my index.php into the category.php and everything formats ok now – but despite trying to delete the php call between the H1 tags and just type in a static title it still doesn’t’ display unfortunately.

    Just type in a static title? A title for what? This template file will be used for all of your category listings. Perhaps you need to review category templates?

    you might need to post a link to your site to illustrate the problem, as it could be caused by css styles.

    you also might need to paste the code of category.php into a https://wordpress.pastebin.com/ and post the link to it here, so someone can have a look at the code.

    Thread Starter djdeejay

    (@djdeejay)

    I know the template will be used for all categories but I just want to get it worked from a total basic standpoint first by entering the title by hand, but even thats not appearing.

    Infact no titles are appearing no matter what settings I have so something isn’t right somewhere.

    Infact no titles are appearing no matter what settings I have so something isn’t right somewhere.

    have you checked the html code of your category pages in the browser to see if the titles are rendered?

    Thread Starter djdeejay

    (@djdeejay)

    Hi alchymyth,

    ok, a little closer now. The theme dev said the blog page (or category) page is in the index.php.

    So I’ve made a new page template (page-grid) and copied the code in. The idea being that I then get individual control over the page as I can’t do anything when the category page is generated automatically from the index.php.

    The page generates and works fine apart from its not pulling blog posts and of course there is no where to set the category as it works a different way than the auto generating one.

    Here is the code currently.

    https://pastebin.com/xqXYGK5L

    How can I change it to pull posts from a specific category ID and still keep its title and subtitle heading set in the page settings.

    I don’t mind setting up page templates for each category I want to display – there would only be at maximum 3 and it gives me a lot of control over each – but its just getting it to display the posts from a specific category with the same formatting the current category page does…

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Force catergory index page to display title if titles don't exist on posts…’ is closed to new replies.