Title: leifer's Replies | WordPress.org

---

# leifer

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

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

 Search replies:

## Forum Replies Created

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

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Loading a default pattern per custom post type](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/)
 *  [leifer](https://wordpress.org/support/users/leifer/)
 * (@leifer)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/#post-17548881)
 * Welp, my PM didn’t like my solution either, but his loss is your gain because
   I took another look at this issue 🙂
   Instead of getting the lowcode from my “
   default content” Pattern by-hand… I just do it programmatically by Post ID of
   my Pattern then return that. Works a mint. I feel both smart and dumb now. I 
   hope WP doesn’t do anything to break this functionality, because using Patterns
   as “pseudo-templates” in this way is super powerful.
 *     ```wp-block-code
       function prefix_filter_book_content($content,$post) {
           if ( $post->post_type === 'book' ) {
               $my_pattern_id = 5055;
               $content_pattern = get_post($my_pattern_id);        
               $content = $content_pattern->post_content;
           }
           return $content;
       }
       add_filter( 'default_content', 'prefix_filter_book_content', 10, 2 );
       ```
   
    -  This reply was modified 2 years, 3 months ago by [leifer](https://wordpress.org/support/users/leifer/).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Loading a default pattern per custom post type](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/)
 *  [leifer](https://wordpress.org/support/users/leifer/)
 * (@leifer)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/#post-17543054)
 * I ran into a similar issue and found this thread looking for the answer myself.
   I was not able to find a way to inject (and automatically detach) a pattern. 
   I don’t know why, but I remade several Patterns and made sure to unsync them,
   but none-the-less when added the way you are adding them above they behaved as
   though they were still synced.
   So, I didn’t find a way to add a Pattern to a 
   Custom Post Type (and detach it).However, I did find a similar work around.
 * Get your “lowcode” from your Pattern. Manage Patterns -> Find your Pattern ->
   Export as JSON.
   Take the value of the “content” of that JSON, that’s your “lowcode”.
 * Example WordPress “lowcode” for a Pattern with two Paragraph blocks and two Heading
   blocks.
 *     ```wp-block-code
       <!-- wp:paragraph -->
       <p>My book paragraph.</p>
       <!-- /wp:paragraph -->
   
       <!-- wp:heading {"level":4} -->
       <h4 class="wp-block-heading">Book Heading</h4>
       <!-- /wp:heading -->
   
       <!-- wp:paragraph -->
       <p>Another Book paragraph</p>
       <!-- /wp:paragraph -->
   
       <!-- wp:heading {"level":4} -->
       <h4 class="wp-block-heading">Another Heading</h4>
       <!-- /wp:heading -->
       ```
   
 * In my case, I had to do some hand-editing to remove newline characters and such,
   but eventually got ‘clean’ lowcode that I could then use to inject into the “
   content” of the post type template.
 *     ```wp-block-code
       function prefix_filter_book_content( $content, $post ) {
           if ( $post->post_type === 'book' ) {
            $content ='<!-- wp:paragraph -->
                       <p>My book paragraph.</p>
                       <!-- /wp:paragraph -->
   
                       <!-- wp:heading {"level":4} -->
                       <h4 class="wp-block-heading">Book Heading</h4>
                       <!-- /wp:heading -->
   
                       <!-- wp:paragraph -->
                       <p>Another Book paragraph</p>
                       <!-- /wp:paragraph -->
   
                      <!-- wp:heading {"level":4} -->
                      <h4 class="wp-block-heading">Another Heading</h4>
                      <!-- /wp:heading -->';
   
           }
           return $content;
       }
       add_filter( 'default_content', 'prefix_filter_book_content', 10, 2 );
       ```
   
 * And, though the setup is a bit “hacky” the end result works. The end-user, when
   they create a new “Book” custom post type, they will get the “Default” Blocks
   added to their Editor. But since they are added as Blocks, and not as a Pattern
   they are treated as page / post content and saved normally without needing to
   detach anything.
   Thank you for listening to my TED talk.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[News Manager] Archive Drop Down does not work.](https://wordpress.org/support/topic/archive-drop-down-does-not-work/)
 *  [leifer](https://wordpress.org/support/users/leifer/)
 * (@leifer)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/archive-drop-down-does-not-work/#post-10000190)
 * Might be a little too old to help [@melissagw](https://wordpress.org/support/users/melissagw/),
   but it looks like the author has pretty much abandoned this plug-in and I recently
   ran into the same problem.
 * The drop-down style Archive Widget can be made functional by doing the following.
 * Open the news-manager/js/front-widget.js file.
 * Immediately after the jquery document ready statement, so starting on line 2,
   add the following:
 * **$(document).on(‘change’, ‘.widget_news_manager_archive_widget select’, function(){
   
   window.location.href = $(this).val(); });
 * There is a lot more that could be done here… but that will add simple redirecting
   functionality back in.

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