• 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

URL Appendage Problem

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 › URL Appendage Problem

This topic is: not resolved
  • This topic has 8 replies, 2 voices, and was last updated 6 years, 10 months ago by Christoph.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • July 27, 2016 at 3:34 pm #190331
    eluviis
    Member

    Hi,

    I'm using the code from minimum to create a portfolio post-type for another Studiopress theme. I've done this before because I really like this little feature. Here's the problem I'm having though. On this particular site, the blog has "blog" prepended to the postname URL. I never do this, but this site has that. Well, I created the CPT (code below) and my problem is that the CPT archive presents itself as /blog/portfolio - I want it to be just /portfolio/

    Any idea what's going on?

    `/** Custom - Create portfolio custom post type */
    add_action( 'init', 'minimum_portfolio_post_type' );
    function minimum_portfolio_post_type() {
    register_post_type( 'portfolio',
    array(
    'labels' => array(
    'name' => __( 'Portfolio', 'minimum' ),
    'singular_name' => __( 'Portfolio', 'minimum' ),
    ),
    'exclude_from_search' => false,
    'has_archive' => true,
    'hierarchical' => true,
    'menu_icon' => 'dashicons-admin-page',
    'public' => true,
    'rewrite' => array( 'slug' => 'portfolio' ),
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'genesis-seo', 'genesis-cpt-archives-settings' ),
    )
    );
    }

    July 27, 2016 at 3:45 pm #190332
    eluviis
    Member

    Basically, I don't want "/blog/" prepended to the post name on my portfolio CPT like it is on the blog. How do I edit the code above to avoid that?

    July 27, 2016 at 4:39 pm #190337
    Christoph
    Member

    Hi,

    you can try changing the rewrite part to:

    'rewrite' => array('with_front' => false, 'slug' => 'portfolio' ),


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    July 27, 2016 at 5:25 pm #190342
    eluviis
    Member

    Hi, thanks, but that doesn't really help. See, all that with_front' => false does is that the posts themselves do not get the "portfolio" slug prepended. But my problem is that I'm getting the "blog" slug prepended before "portfolio" because it's in the permalink settings to add that to the blog. But I don't want that to affect my custom post types such as this one.

    July 27, 2016 at 5:29 pm #190343
    eluviis
    Member

    EDIT: Nevermind. That seems to have done the trick. It's working now.

    Quick question. That code that I posted above is based off the original Minimum theme, ie, not HTML5. The new Minimum Pro them (HTML5) uses templates for the portfolio custom post type. Am I asking for trouble here, or is the code above perfectly legitimate?

    July 27, 2016 at 6:01 pm #190345
    Christoph
    Member

    I´m glad it´s working.

    No, this code is independent from the HTML version that is used to display the content. You should have no problems.

    Executive Pro is the "go to HTML5 theme" to borrow the code to register a portfolio CPT but you could also take the code from the new Genesis Portfolio Pro plugin (https://wordpress.org/plugins/genesis-portfolio-pro/)


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    July 27, 2016 at 6:27 pm #190348
    eluviis
    Member

    ^^^ Thanks. That plugin might be very useful. I got the CPT working great now thanks to you. However, the old CSS code I used to use doesn't play nice with the theme I'm using now. Maybe this plugin will give me CSS code I can use. Apart from that, I can't have the portfolio named "portfolio" - needs to be gallery, so I've changed all the names with search and replace.

    July 28, 2016 at 11:24 am #190387
    eluviis
    Member

    @Christoph - That portfolio plugin is actually really good. I like how it works and I like how it includes the CSS I need to make it look more or less how I want. Hard-coding it in the way I usually do it won't give me this kind of depth as I usually do it much more simpler.

    One question though. You think there is way I can change "portfolio" to "gallery" in the plugin without hacking the plugin? I don't want it to revert back to portfolio during the next update. Otherwise, really good.

    July 28, 2016 at 11:50 pm #190420
    Christoph
    Member

    There is no interface to change the CPT name.

    You could upload a renamed copy of the plugin in which you change post-types-and-taxonomies.php
    to use gallery instead of portfolio.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

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