WordPress.org

Ready to get started?Download WordPress

Forums

Comment Off (7 posts)

  1. Root
    Member
    Posted 3 years ago #

    Hi guys / girls and thanks in advance
    i would love to add a function to functions.php to eliminate all references to comments on pages of static content
    ie
    if a page
    do nothing
    if a post
    do yr comment stuff
    there must be a function for this somewhere already ?
    this is assuming of course that the functions.php in default child themes gets fixed soon
    ty

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    I don't see any benefit to adding something to functions.php for this kind of thing. Why not just omit the call to `<?php comments_template();?>
    ` in page templates?

    this is assuming of course that the functions.php in default child themes gets fixed soon

    Why? What's wrong? I've not noticed any problems in child themes.

  3. Root
    Member
    Posted 3 years ago #

    omg
    how can u suggest hacking the default ?
    i want a pure child theme to protect my upgrade path and all the other goodness
    any fool can hack the core...........

  4. elfin
    Moderator
    Posted 3 years ago #

    Why not just omit the call to <?php comments_template();?> in page templates?

    esmi was not suggesting you hack core, she was suggesting you change the templates for pages within your theme to omit calls to comments.

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    how can u suggest hacking the default ?

    Pardon? Hacking what default? page.php and functions.php can be found in both the parent and child theme. You use the custom files in the child theme. That is the purpose of child themes, after all.

  6. Root
    Member
    Posted 3 years ago #

    well this is interesting. If we replace template files by copying them into our child theme then hacking errrrrr patching them......we lose the stand alone nature of childs...........its a short step from there to omit the step and hack the default i guess.........i wish there was a model that allowed us to do this but there is such a plethora of templates now in default, most imho could be reamalgamated into index with appropriate conditionals...........then we only need add to functions php at the child theme level........

    in fact what u propose is worse that hacking the default because if u run a lot of sites yr upgrade path is really ugly........the notion of child themes can only take root if the parent is sufficiently robust eg more action hooks;

  7. esmi
    Forum Moderator
    Posted 3 years ago #

    .we lose the stand alone nature of childs

    A child theme isn't standalone by definition. It requires that the parent also be installed.

    its a short step from there to omit the step and hack the default i guess

    I think you might be missing the point of child themes. If you make your customisations in a child, you can happily upgrade the parent without over-writing your custom templates/functions/CSS. so you can have all the benefits that a parent upgrade might bring in terms of extra functionality without having to re-customise from scratch again.

    in fact what u propose is worse that hacking the default because if u run a lot of sites yr upgrade path is really ugly

    I'm sorry but that's simply not true. I can build a parent theme and install it on 20 different sites - each with their own custom child theme. If I then want to add extra functionality to every site (for example, add 3.1 post format support), I simply need to edit a single theme (the parent) and upgrade that single theme each site instead of upgrading 20 different themes.

    Having originally had about 14-15 free themes available for download on my sites, I can assure you that keeping them up up-to-date with the latest WordPress functionality was a major chore. So much so, that I'm gradually retiring them in favour of only a couple of child-aware parent themes and associated child themes as, and when, needed. It makes my life a lot easier and means that I can get parent upgrades out far more quickly with each WordPress release.

    the notion of child themes can only take root if the parent is sufficiently robust eg more action hooks

    I wouldn't necessarily say that more action hooks are needed - although I'd dearly love to see a de-register hook similar to that available for plugins on deletion. I do think that parent themes need to be built with child themes in mind - otherwise building the child can become an exercise in frustration. Plenty of filters and nice modular functions seems the best approach, in my opinion. But you never really know how well you've implemented this until people start building child themes. Which is one of the reasons that my latest theme has recently been released as a beta - so that people can try it out and feedback any issues.

Topic Closed

This topic has been closed to new replies.

About this Topic