Okay
  Public Ticket #3208683
how to Change URL Slug for Portfolio Type?
Closed

Comments

  • Frontism started the conversation

    Hi,

    I want to change the name and slug of "portfolio" to "prismodtager". I dit used this plugins ->> its working but not perfect. 

    I can't see the results in search in them list from this post (Portfolio).

    Can you help me to change "portfolio" item to "prismodtager" in the best way?

    Regards

    Masoud<?php

    /**  * Plugin Name: Genesis Portfolio Pro Custom Slugs  * Description: Alters Genesis Portfolio slugs.  * Version: 0.1.0  */

    namespace GPPCS;

    add_filter( 'register_taxonomy_args', 'GPPCSportfolio_type_args', 10, 2 ); /**  * Change Genesis Portfolio Type arguments.  *  * @param array  $args Taxonomy arguments.  * @param string $taxonomy Current taxonomy.  * @return array New taxonomy arguments.  */ function portfolio_type_args( $args, $taxonomy ) { if ( 'Prismodtager' === $taxonomy ) { $args['rewrite']['slug'] = 'project-type'; }

    return $args; }

    add_filter( 'register_post_type_args', 'GPPCSportfolio_args', 10, 2 ); /**  * Change Genesis Portfolio arguments.  *  * @param array  $args Post type arguments.  * @param string $post_type Current post type.  * @return array Filtered post type arguments.  */ function portfolio_args( $args, $post_type ) { if ( 'portfolio' === $post_type ) { $args['rewrite']['slug'] = 'prismodtager'; }

    return $args; }

     

  •  866
    Neuron replied

    Hi,

    Can you please provide me with your wp-admin, I will have a quick look to see what's going on.

    Feel free to ask for anything you need.

    Kind Regards


  •   Frontism replied privately
  •  866
    Neuron replied

    Hi Masoud,

    I'm seeing that the way you've changed them is working all right on your site, I just want to send this plugin to you in case you face any issues in the future with the permalinks.

    We have already tested the plugin and it works alright with our theme.

    https://wordpress.org/plugins/permalink-manager/

    Feel free to ask for anything you need.

    Kind Regards


  •   Frontism replied privately
  • Frontism replied

    Hi,

    in search.php I added 'portfolio' like below and its working know.
    I think it was a bug in search.php !

    Befor:


    $args = array_merge( $wp_query->query_vars, array( 'post_type' => [ 'post', 'page', ] ) );

    After:


    $args = array_merge( $wp_query->query_vars, array( 'post_type' => [ 'post', 'page', 'portfolio' ] ) );

    Best

    Masoud

  •  866
    Neuron replied

    Hi Frontism,

    Thanks for sharing that, we'll take a look at it and include it in the upcoming updates.

    Feel free to ask for anything you need.

    Kind Regards