• 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

Function Error in Prose

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 › Design Tips and Tricks › Function Error in Prose

This topic is: not resolved
  • This topic has 4 replies, 2 voices, and was last updated 12 years, 11 months ago by angieatc.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 16, 2013 at 9:52 am #56819
    angieatc
    Member

    I am working on a site (beginning stages) and I am adding some code to the custom functions section under Genesis. I am actually taking this code from Backcountry so my description will appear on the menu bar:

    /** Add description to secondary navigation */
    add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 ); 
    function add_description( $item_output, $item, $depth, $args ) {
    
    	$args = (array) $args;
           
    	if ( $args['theme_location'] != 'primary' )  {
    		return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output ); 
    	}
    	else {
    		return $item_output;
    	}
    
    }

    This is the error I am getting:
    Parse error: syntax error, unexpected T_STRING in /home3/angieatc/public_html/test1/wp-content/uploads/prose/custom.php on line 11

    I do not get this error if I load this in a normal function file from another theme.


    My design site, Hill Springs Designs

    http://test1.strosgirldesigns.com/
    August 16, 2013 at 10:40 am #56831
    Brad Dalton
    Participant

    Might need to put it into a plugin.http://www.studiopress.community/topic/add-new-widgetized-area-in-prose/page/2/#post-55822


    Tutorials for StudioPress Themes.

    August 17, 2013 at 3:55 pm #57087
    angieatc
    Member

    So would the code look like this in the file and save it as extracode.php (or whatever I want to add? Would I add post signature and other codes in there as well?

    /*
    Plugin Name: Prose Custom Code
    Plugin URI: http://example.com
    Description: Loads customizations for my site
    Version: 0.1.0
    Author: Angie Lambert
    Author URI: http://strosgirldesigns.com
    License: GPLv2 or later
    */
    
    /** Add description to secondary navigation */
    add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 ); 
    function add_description( $item_output, $item, $depth, $args ) {
    
    	$args = (array) $args;
           
    	if ( $args['theme_location'] != 'primary' )  {
    		return preg_replace( '/(<a.*?>[^<]*?)</', '$1' . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output ); 
    	}
    	else {
    		return $item_output;
    	}
    
    }

    My design site, Hill Springs Designs

    August 17, 2013 at 4:03 pm #57088
    Brad Dalton
    Participant

    Add all your custom PHP code.


    Tutorials for StudioPress Themes.

    August 17, 2013 at 4:08 pm #57090
    angieatc
    Member

    I tried, I get an error:

    /* Plugin Name: Prose Custom Code Plugin URI: http://example.com Description: Loads customizations for my site Version: 0.1.0 Author: Angie Lambert Author URI: http://strosgirldesigns.com License: GPLv2 or later */ /** Add description to secondary navigation */ add_filter( 'walker_nav_menu_start_el', 'add_description', 10, 4 ); function add_description( $item_output, $item, $depth, $args ) { $args = (array) $args; if ( $args['theme_location'] != 'primary' ) { return preg_replace( '/([^<]*?){$item->post_content}<", $item_output ); } else { return $item_output; } }

    **edit, I did not remove the code from the functions so it gave me the line error but this is the error I get now.


    My design site, Hill Springs Designs

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ 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