_PUIKA_ Posted February 20, 2012 Report Share Posted February 20, 2012 Hi guys! So, basically I have built custom post type and I have added few custom fields by ACF plugin (for example - <product name>). In functions.php, where I am registering this custom post type, in arguments array, I have excluded all supported fields (title,editor,thumbnail etc.) so I could add my ACF custom fields and make custom post title from custom field values(for example - "My custom post title" is replaced with "<product name>") I am using code below to change custom post title to custom field values: /* Set post title from meta field */ function new_title($title) { global $post, $post_ID; if(get_field('auto_marka')){ $title = get_field('marka') . ' | ' . get_field('modelis') . ' ' . $title; } if(get_field('prece_nosaukums')){ $title = get_field('prece_nosaukums') . ' | ' . get_field('modelis') . ' ' . $title; } return $title; } add_filter('the_title', 'new_title'); The problem is that, when I am trying to search for products in search page, all the navigation menu's links are replaced with first custom post search result's title (For example: "Home" is replaced with - <product name>Home) Below is navigation menu code, that is used in search.php: <?php if ( has_nav_menu( 'primary-menu', 'mytheme' ) ) { ?> <?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'primary-menu', 'fallback_cb' => 'display_home', 'exclude' => 'home' ) ); ?> <?php } else { ?> <?php wp_list_pages('title_li=&depth=4&sort_column=menu_order'); ?> <?php } ?> I have big headaches with this, because I am trying to fix this problem for days, so I would really appreciate your help! :@ P.S.I have attached a screen-shot so you could understand the situation better. If link is broken, you can check screen-shot by following link below: http://img607.imageshack.us/img607/9383/98682975.png With best wishes, Ricards Quote Link to comment Share on other sites More sharing options...
Kracker Posted March 6, 2012 Report Share Posted March 6, 2012 Atrisinājums: http://teketen.com/liburutegia/Wordpress_for_dummies.pdf Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.