Title: beetrootman's Replies | WordPress.org

---

# beetrootman

  [  ](https://wordpress.org/support/users/beetrootman/)

 *   [Profile](https://wordpress.org/support/users/beetrootman/)
 *   [Topics Started](https://wordpress.org/support/users/beetrootman/topics/)
 *   [Replies Created](https://wordpress.org/support/users/beetrootman/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/beetrootman/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/beetrootman/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/beetrootman/engagements/)
 *   [Favorites](https://wordpress.org/support/users/beetrootman/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/users/beetrootman/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/beetrootman/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] [Plugin: Relevanssi – A Better Search] Show custom fields and excerpts](https://wordpress.org/support/topic/plugin-relevanssi-a-better-search-show-custom-fields-and-excerpts/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-relevanssi-a-better-search-show-custom-fields-and-excerpts/#post-3002150)
 * I’ve tried using get_the_excerpt but I can’t figure it out. Even simply trying
   to add a single word isn’t working as I would except. It’s adding my text twice.
   For example with this code
 *     ```
       add_filter('get_the_excerpt', 'filter_excerpt');
   
       function filter_excerpt($descrip) {
   
       return "Test: $descrip";
       }
       ```
   
 * I get “Test: Test: ……..”. Anyway since the complete excerpt is getting passed
   through the filter, I’m not sure I can do much with it, since I effectively need
   to have two excerpts to use, one for the normal post content, and one for my 
   custom field. Is it possible to point me in the direction? Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Relevanssi - A Better Search] [Plugin: Relevanssi – A Better Search] Show custom fields and excerpts](https://wordpress.org/support/topic/plugin-relevanssi-a-better-search-show-custom-fields-and-excerpts/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-relevanssi-a-better-search-show-custom-fields-and-excerpts/#post-3002013)
 * Ok, so I have it working as follows. However I noticed a problem (for my needs
   anyway). When relevanssi is actually making the excerpt from the custom filed
   or content, if the search term is towards the end of the text, it cuts off the
   beginning, so that “Contents:” or “Description:” is lost (normal behavior I assume).
 * I can only think that it my situation the best solution would be to be able to
   set three of four different functions for excerpts, therefore I can retain control
   of how they are used within my template. Would that be possible without modifying
   the core? I noticed that the filter for this is in excerpt-highlights. It would
   be possible to add, but I don’t really want to mess with that:
    `$content = apply_filters('
   relevanssi_excerpt_content2', $content, $post, $query);`
 * Current excerpt function:
 *     ```
       add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3);
       function excerpt_function($content, $post, $query) {
   
       if ( 'covers' == get_post_type() ) {
       	if($post->post_content !== "") {
       		$content = "Description: $content<br />";
       	}
       }
   
       $fields = array('custom_contents');
       $search_query = get_search_query();
       foreach($fields as $key => $field){
       	$field_value = get_post_meta($post->ID, $field, TRUE);
       		if (stripos($field_value,$query) !== false) {
       		$content .= 'Contents:' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value );
       	}
       }
   
       return $content;
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Dynamic number of posts per page](https://wordpress.org/support/topic/dynamic-number-of-posts-per-page/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/dynamic-number-of-posts-per-page/#post-2994355)
 * Ah yes, that’s a better idea, but I’m not sure how I would use ajax to add the
   posts, since at the moment it’s done automatically with the paginated pages. 
   Any tips?
 * Thanks
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Dynamic number of posts per page](https://wordpress.org/support/topic/dynamic-number-of-posts-per-page/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/dynamic-number-of-posts-per-page/#post-2994331)
 * I don’t want to load all posts at once because there are about 250 and for each
   post there is an image, so it’s kind of a heavy load.
 * Here is the code for the template:
    [http://pastebin.com/ayv0qGku](http://pastebin.com/ayv0qGku)
 * And the loop file:
    [http://pastebin.com/RB3fZ4xf](http://pastebin.com/RB3fZ4xf)
 * Bear in mind I am using this function to make pagination work for my custom post
   type:
 *     ```
       function paginate() {
           global $wp_query, $wp_rewrite;
           $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
           $pagination = array(
               'base' => @add_query_arg('page','%#%'),
               'format' => '',
               'total' => $wp_query->max_num_pages,
               'current' => $current,
               'show_all' => true,
               'type' => 'plain',
       		'prev_text' => __('&larr;'),
       		'next_text' => __('&rarr;')
           );
           if ( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
           if ( !empty($wp_query->query_vars['s']) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) );
           echo paginate_links($pagination);
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Best way to do this…](https://wordpress.org/support/topic/best-way-to-do-this-2-2/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/best-way-to-do-this-2-2/#post-1929963)
 * In the end I used this plugin: [http://wordpress.org/extend/plugins/simple-fields/](http://wordpress.org/extend/plugins/simple-fields/)
   it allows you to create a custom field that is repeatable/duplicatable by a user
   writing the post.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Custom post type capabilities 3.1](https://wordpress.org/support/topic/custom-post-type-capabilities-31/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-post-type-capabilities-31/#post-1939747)
 * [http://wordpress.pastebin.com/8XkBMteR](http://wordpress.pastebin.com/8XkBMteR)
   code here
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Best way to do this…](https://wordpress.org/support/topic/best-way-to-do-this-2-2/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/best-way-to-do-this-2-2/#post-1929631)
 * Not exactly what I want no. A bit too complicated as well. Thank you though.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Custom Field Template plugin help "add another"](https://wordpress.org/support/topic/custom-field-template-plugin-help-add-another/)
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-field-template-plugin-help-add-another/#post-1903916)
 * I am also trying to do this.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[thumbGen] [Plugin: thumbGen] New settings annoying](https://wordpress.org/support/topic/plugin-thumbgen-new-settings-annoying/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-thumbgen-new-settings-annoying/#post-1729759)
 * Hi, Ok I understand about the parameters. Don’t get me wrong it is an excellent
   plugin and I am grateful for it.
 * It was just frustrating that on the first update the default folder for images
   was changed, it could have been left as uploads/cache with the option to change.
   And next time round I had to go and and recode the template everywhere thumbgen
   was used.
 * I am still having a problem that the two pieces of code below give the same image
   name. When I would presume they should be different since one is grayscale and
   the other is not.
 * thumbGen($thumburl,300,0,”effect=grayscale&md5=0″)
    thumbGen($thumburl,300,0,”
   md5=0″)
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Custom Post types querying](https://wordpress.org/support/topic/custom-post-types-querying/)
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-types-querying/#post-1691575)
 * Yes I believe so, although I’ve never done it myself. It’s explained in the codex
   though, under loop.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Custom post type yearly archive](https://wordpress.org/support/topic/custom-post-type-yearly-archive/)
 *  Thread Starter [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-yearly-archive/#post-1691548)
 * Ok, this plugin:
 * [http://wordpress.org/extend/plugins/custom-post-permalinks/](http://wordpress.org/extend/plugins/custom-post-permalinks/)
 * gets the permalink system working. But I still can’t generate a list the gives
   links to the correct yearly archive.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Custom Post types querying](https://wordpress.org/support/topic/custom-post-types-querying/)
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-types-querying/#post-1691353)
 * Hi, can’t pm so I’ll explain here. In order to separate different types of posts
   you need a custom template.
 * You would make a page called products, then make template called products.php
   and set that page to use it.
    Inside that template before: <?php if (have_posts()):?
   > You would put: <?php query_posts(‘post_type=product’); ?> Which means only 
   product type posts are displayed.
 * Try searching for ‘page templates’ and ‘query_posts’.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Custom Post Type Parent](https://wordpress.org/support/topic/custom-post-type-parent/)
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563541)
 * different issue entirely. I will PM you some info.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Custom Post Type Parent](https://wordpress.org/support/topic/custom-post-type-parent/)
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563539)
 * No wait, that wouldn’t work because when you view a single post it always uses
   single.php or a variation of it. No way of displaying single posts through a 
   page template as far as I’m aware.
 * There must be some way of hacking this.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Custom Post Type Parent](https://wordpress.org/support/topic/custom-post-type-parent/)
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563538)
 * This annoying me as well. It basically renders the whole current_parent_item 
   class naming pointless, since if you use posts the only parent you ever have 
   is blog.
 * The only was I can think of to get around it is creating a series of child pages
   and custom page templates like so:
 * Parent:Work Page: Shows all custom type work posts.
    child:Single work page: 
   Shows single work post. child:Single work cat page: If you have some categories
   for work posts. chuld:Single work archive page: Archive of work posts.
 * I think, in theory, the current_page_item WOULD be ‘Work page’ for all the child
   pages, even though they are showings posts. The annoying this about this is that
   you have to make loads of pages and different templates. I’ll test it out and
   let you know if it works.

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/users/beetrootman/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/beetrootman/replies/page/2/?output_format=md)