Title: Help with a function
Last modified: April 30, 2018

---

# Help with a function

 *  Resolved [dpendleton](https://wordpress.org/support/users/dpendleton/)
 * (@dpendleton)
 * [8 years ago](https://wordpress.org/support/topic/help-for-a-newb-with-a-function/)
 * Hi, I’ve tried to fix this issue myself, but am new to coding/php and haven’t
   managed to get it working. I’m using the SearchWP Live Ajax Search plugin and
   am trying to get it show the Category after the page title, rather than the post
   type. Here is the code:
 *     ```
       <?php if ( have_posts() ) : ?>
       	<?php while ( have_posts() ) : the_post(); ?>
       		<?php $post_type = get_post_type_object( get_post_type() ); ?>
       		<div class="searchwp-live-search-result" role="option" id="" aria-selected="false">
       			<p><a>">
       				<?php the_title(); ?> (<?php echo esc_html( $post_type->labels->singular_name ); ?>) &raquo;
       			</a></p>
       		</div>
       	<?php endwhile; ?>
       <?php else : ?>
       	<p class="searchwp-live-search-no-results" role="option">
       		<em><?php esc_html_x( 'No results found.', 'swplas' ); ?></em>
       	</p>
       <?php endif; ?>
       ```
   
 * I understand it’s the `<?php $post_type = get_post_type_object( get_post_type());?
   >` line I need to change (I think) and assume it’s get_category I would need 
   to use? Just can’t figure out the syntax. Would appreciate any help!
 * Thanks
    -  This topic was modified 8 years ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
    -  This topic was modified 8 years ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Fixed formatting

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [8 years ago](https://wordpress.org/support/topic/help-for-a-newb-with-a-function/#post-10232054)
 * Can you instead ask at the plugin’s support sub-forum? Plugin specific questions
   are best in their sub-forum.
 * [https://wordpress.org/support/plugin/searchwp-live-ajax-search/#new-post](https://wordpress.org/support/plugin/searchwp-live-ajax-search/#new-post)
 *  Thread Starter [dpendleton](https://wordpress.org/support/users/dpendleton/)
 * (@dpendleton)
 * [8 years ago](https://wordpress.org/support/topic/help-for-a-newb-with-a-function/#post-10232087)
 * Will do, thanks for the help.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [8 years ago](https://wordpress.org/support/topic/help-for-a-newb-with-a-function/#post-10232103)
 * Cool, topic continues here.
 * [https://wordpress.org/support/topic/help-newb-with-code/](https://wordpress.org/support/topic/help-newb-with-code/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Help with a function’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/help-for-a-newb-with-a-function/#post-10232103)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
