• 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

Custom plugin for functions not working

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 › Custom plugin for functions not working

This topic is: not resolved

Tagged: schema

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 1 month ago by carasmo.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 24, 2016 at 2:10 pm #186208
    lsilver
    Member

    I've created a custom plugin to hold a few functions that remove the Genesis schema markup from a few elements (I'm using a 3rd party plugin instead). If I paste the functions themselves into Dynamik Custom > Functions (I'm using the Dynamik child theme), they work just fine. So I know that the coding is correct. But for some reason when enabled it doesn't take effect.

    Here is the code for the plugin (it's the only file in the plugin folder, named plugin-name.php):

    <?php
    /**
    * Plugin Name: Remove Genesis Schema To Use Schema App
    * Plugin URI: https://mysite.com/
    * Description: A custom plugin to remove Schema markup added by the Genesis theme that is replaced by the Schema App plugin.
    * Version: 1.0
    * Author: Lloyd Silver
    * Author URI: https://about.me/myname
    **/
    
    add_filter( 'genesis_attr_entry', 'remove_genesis_schema_creativeworks' );
    function remove_genesis_schema_creativeworks( $attributes ) {
    		if (is_singular('post') ) {
                    $attributes['itemprop'] = false;
    				$attributes['itemscope'] = false;
                    $attributes['itemtype']  = false;
    		}
                    return $attributes;
    }
    
    add_filter( 'genesis_attr_body', 'remove_genesis_schema_webpage' );
    function remove_genesis_schema_webpage( $attributes ) {
    		if (is_singular('post') || is_home() || is_page() ) {
                    $attributes['itemprop'] = false;
                    $attributes['itemscope'] = false;
                    $attributes['itemtype']  = false;
    		}
                    return $attributes;
    }
    
    add_filter ( 'genesis_attr_entry-author', 'remove_genesis_schema_author' );
    function remove_genesis_schema_author( $attributes ) {
    		if (is_singular('post') ) {
                    $attributes['itemprop'] = false;
                    $attributes['itemscope'] = false;
                    $attributes['itemtype']  = false;
    		}
                    return $attributes;
    }
    May 24, 2016 at 2:27 pm #186210
    carasmo
    Participant

    A plugin is different from a functions.php file and requires a different action, here's a list of them:

    https://codex.wordpress.org/Plugin_API/Action_Reference

    You would use after_setup_theme but genesis_init would do it. You would also want to make sure that the theme is Genesis, so take a look at the first tut

    Take a look at this tutorial:

    Genesis Plugins: Your First WordPress Plugin

    or use http://wpclips.net/ and put your functions in the custom-functions.php file.


    Genesis Theme Customization and Help

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 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

© 2026 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