• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Overwrite function in single.php Monochrome-Pro

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Overwrite function in single.php Monochrome-Pro

This topic is: not resolved

Tagged: functions, single.php

  • This topic has 3 replies, 3 voices, and was last updated 3 years, 2 months ago by Anita.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • December 27, 2019 at 2:48 pm #495659
    webdziner
    Participant

    Hi, I have been trying to overwrite the function to display the featured image and gravatar in the header of Monochrome-Pro's single.php. I don't want to edit the file itself.
    In my functions file I've tried
    remove_action( 'genesis_before', 'monochrome_setup_full_width' );
    and also

    add_action('after_setup_theme', 'remove_parent_functions');
    function remove_parent_functions() {
    remove_action( 'genesis_before', 'monochrome_setup_full_width' );
    }

    How can I accomplish this? I have 5 custom post types, so I can create individual single-post-type.php pages, but, would rather use code in my functions.php file. Any ideas?

    December 27, 2019 at 5:16 pm #495660
    Victor Font
    Moderator

    You're problem is a timing issue. Functions.php executes before single.php is loaded. You're removing an action that hasn't even been defined yet. If you don't want the action to load in single.php for certain post types, then edit single.php and wrap that action in a WordPress conditional that tests for the specific post types.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    December 28, 2019 at 7:34 pm #495673
    webdziner
    Participant

    No Wonder. So, there's no way? I was wondering about using a custom post type template. But, it seems that those would have to be manually selected withing the Post attributes. Is there any way to assign it automatically?

    I didn't want to modify the single.php. I hate to have to remember to re-modify files after an update, but, it would be easy enough to use a conditional. Thank You.

    December 29, 2019 at 10:44 am #495681
    Anita
    Keymaster

    Some theme developers have done it this way:

    Create a file called: genesis-changes.php. Save that in the /inc folder of the theme. Or create it if you don't have it.

    Then in functions.php, add this below the line that says //Load Genesis which should be loading the init.php file.

    // Genesis Changes
        include_once( get_stylesheet_directory() . '/inc/genesis-changes.php' );
    

    Try that. Several third-party themes work that way.

    That will load whatever you put in the genesis-changes.php file first.


    Love coffee, chocolate and my Bella!

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble