WordPress.org

Ready to get started?Download WordPress

Forums

History Tracker
Display only a particular post type view? (8 posts)

  1. Ethan Shaw
    Member
    Posted 3 years ago #

    Is there a way to have this plugin show only the user's history for a certain post type instead of everything?

    Thanks for the awesome plugin guys!

    http://wordpress.org/extend/plugins/history-tracker/

  2. enej
    Member
    Plugin Author

    Posted 3 years ago #

    There is you would have to modify the history-tracker.php file
    and change the function history_tracker_store_page on line 158.

    and use something like
    if ( is_post_type( 'super-duper' ) )

    and comment out the other once.

    I hope that helps.

    Cheers Enej

  3. Ethan Shaw
    Member
    Posted 3 years ago #

    Thanks so much Enej!

    Can I make a small donation somewhere?

  4. Ethan Shaw
    Member
    Posted 3 years ago #

    I forgot to ask I'm getting this error when I comment out the other stuff, I feel that I'm missing something obvious though. Can you help me once more?

    error: Fatal error: Call to undefined function is_post_type() in xxx

    //	if(is_archive()):
    
    	/* figure out what kind of page it is and set the title
    
    		/* taxonomy, category and tags archives.
    		if(is_tax() || is_category() || is_tag()):
    			$term = $wp_query->get_queried_object();
    			$title = "Archive: ".$term->name;
    		endif;
    		/* Author archives.
    		if(is_author())
    			$title = "Author Archive: ".get_the_author_meta( 'display_name', get_query_var( 'author' ) );
    
     		/* Minutely and hourly archives.
     		if ( get_query_var( 'minute' ) && get_query_var( 'hour' ) ) :
    			$title = "Archive: ".  get_the_time('g:i a') ;
    
    		/* Minutely archives.
    		elseif ( get_query_var( 'minute' ) ) :
    			$title = "Archive: ".  sprintf( 'Minute %1$s', get_the_time( 'i'  ) );
    
    		/* Hourly archives.
    		elseif ( get_query_var( 'hour' ) ) :
    			$title = "Archive: ". get_the_time( 'g a' );
    
    		/* Daily archives.
    		elseif ( is_day() ) :
    			$title = "Archive: ". get_the_time( 'Y/m/j' ) ;
    
    		/* Weekly archives.
    		elseif ( get_query_var( 'w' ) ) :
    			$title = "Archive: ". sprintf( 'Week %1$s' , get_the_time( 'W') );
    
    		/* Monthly archives.
    		elseif ( is_month() ) :
    			$title = "Archive: ". get_the_time( 'Y F' ) ;
    
    		/* Yearly archives.
    		elseif ( is_year() ) :
    			$title = "Archive: ". get_the_time( 'Y' ) ;
    		endif;
    	endif;
    	/* 404 Page.
    	if(is_404())
    		$title = "Page Not Found";
    	/* Search Page.
    	if(is_search())
    		$title = "Search: ". esc_attr( get_search_query() );
    
    	/* Home Page.
    	if(is_home())
    		$title = "Home";
    
    	/* Single, attachment and just a regular old page.
    	if(is_page() || is_single() || is_attachment())
    		$title = $post->post_title;
    
    	/* custom post type */
    	if(is_post_type('inventory'))
    		$title = $post->post_title;
  5. enej
    Member
    Plugin Author

    Posted 3 years ago #

    Hi Ethan

    If you feel like donating, donate to the red cross. Here is a link
    http://www.redcross.ca/donateonlinenow/ =)

    I am sorry I gave you the wrong code, apparently is_post_type only existed briefly in 3.0 development.

    I think what you should do instead is of
    if(is_post_type('inventory')
    is
    if ( 'inventory' == get_post_type() )

    I hope that works for you.

    Cheers Enej

  6. cyberfret
    Member
    Posted 3 years ago #

    Thanks for the great plugin.

    What I did to only show a particular post type in the history was to write to the cookie only if it was that post type. So I only wanted posts to show, so I replaced...

    setcookie("History-Tracker", $value, time()+9800, "/", HTgetHost(get_bloginfo('url')) );

    at line 242 with...

    if(is_single()) setcookie("History-Tracker", $value, time()+9800, "/", HTgetHost(get_bloginfo('url')) );

  7. enej
    Member
    Plugin Author

    Posted 3 years ago #

    Hi cyberfret
    Thanks for posting your solution!

  8. emmerdesign
    Member
    Posted 2 years ago #

    When you visit the home page for the first time it gives the text: page not found. If you navigate to pages the visited pages shows up. How can I fix this?

    THanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic