Custom Post Type in page block

Posted in: Newspaper
Post count: 16

Hi
I have created Custom Post Type as shown in the Newspaper documentation https://forum.tagdiv.com/custom-post-type-support/

And now I want to show them on a page with the block modul but I can’t see the “genre” or “writers” in the block dropdown on setting > filter and if I write the tag_ID of the writer or genre nothing is shown on the page…

http://imgur.com/a/DaqWd

What can I do to use the Custom Post Types with the blocks?

Post count: 6535

Hi

The name of custom post type is td_book and you use in block settings td_books that’s why there is no post displayed there. Try to use td_book, clear all caches then test the site again.

Let us know how it goes.
Thanks!

Post count: 16

Yeah sorry, wrote that just for a quick image.
did a new more discribing image…

the first show the posts in “Books” and the tag ID for the Genre “lek”
http://imgur.com/gFCUkkU

the second shows the setting of the blocks
http://imgur.com/a/aRjNX

the third shows the outout…
http://imgur.com/pdhlLXZ

So in words, I only want to show the posts that have the “genre” “lek” not all of the posts under books.

Post count: 6535

Hi

Unfortunately the theme don’t have an option to sort custom post types by tags or other similar filters, you can only select the desired post type and it will be displayed in that block. A solution would be to use post id filter and insert in that filed only the ids for those custom posts that you want to display.

Thanks!

Post count: 16

Sorry, I don’t really understand what you tried to explain…

Can you elaborate this sentence

A solution would be to use post id filter and insert in that filed only the ids for those custom posts that you want to display.

Post count: 23312

Hello enestedt,

As my colleague Andrei said you above, our theme does not have such an option that allows you to filter the custom posts type by tags or other similar filters, sorry! The only way to filtrate your custom posts type is by post ID which you should add all of them in the Post ID Filter, like this -> http://screencast.com/t/XaXPhFexG Also, for getting the post ID you will have to follow this steps, like this -> http://screencast.com/t/33bPPJiEn

I hope that you understand it.

Thanks for your message!

Post count: 16

For those that find this thread.

I made a custom template from the page.php where I instead of the

<?php the_content(); ?>
used this code (it’s looking like the block 11 and have 2 sidebars, you can customise that after your needs)

<div class="td-pb-row">
                        <div class="td-pb-span6 td-main-content" role="main">
                            <div class="td-ss-main-content">
                                <div class="td_block_wrap td_block_11 td_uid_2_58086a26d405d_rand td-pb-border-top" data-td-block-uid="td_uid_2_58086a26d405d">
                                     <div class="td-block-title-wrap">
                                        <h4 class="block-title">
                                            <span style="margin-right: 0px;">
                                                <?php echo $page_path; ?>
                                            </span>
                                        </h4>
                                    </div>
                                    <div class="td_block_inner">
                                        <div class="td-block-span12">

                                            <?php
$page_path = end(explode('/', trim($_SERVER['REQUEST_URI'], '/')));

                                                if (stristr($_SERVER['REQUEST_URI'], '/PAGE URL/')):
                                                    query_posts( array( 'post_type' => 'CUSTOM POST NAME', 'CUSTOM POST TAXANOMY NAME' => $page_path ) );
                                                elseif (stristr($_SERVER['REQUEST_URI'], '/PAGE URL/')):
                                                    query_posts( array( 'post_type' => 'CUSTOM POST NAME', 'CUSTOM POST TAXANOMY NAME' => $page_path ) );
                                                else:
                                                    query_posts( array( 'post_type' => 'CUSTOM POST NAME', 'CUSTOM POST TAXANOMY NAME' => 'TAXANOMY NAME' ) );
                                                endif;

                                              //the loop start here
                                              if ( have_posts() ) : while ( have_posts() ) : the_post();
                                            ?>
                                                <div class="td_module_10 td_module_wrap td-animation-stack td-meta-info-hide">
                                                    <div class="td-module-thumb">
                                                        <a class="td-admin-edit" href="/wp-admin/post.php?post= <?php echo get_the_id(); ?> &action=edit">
                                                            edit
                                                        </a>
                                                        <a href="<?php echo get_permalink();?>" rel="bookmark" title="<?php the_title(); ?>">
                                                             
                                                            <?php  echo get_the_post_thumbnail(); ?>
                                                        </a>
                                                    </div>

                                                    <div class="item-details">

                                                        <h3 class="entry-title td-module-title">
                                                            <a href="<?php echo get_permalink();?>" rel="bookmark" title="<?php the_title(); ?>">
                                                             
                                                            <?php the_title(); ?></a>
                                                        </h3>
                                                        <div class="td-module-meta-info">
                                                        </div>
                                                        <div class="td-excerpt">
                                                            <?php the_excerpt(); ?>
                                                        </div>
                                                    </div>
                                                </div>

                                            <?php endwhile; else: echo 'Det finns inga artiklar kopplade till ämnet "' .$page_path .'".';endif; wp_reset_query(); ?>
                                        </div>
                                     <!-- ./td-block-span12 -->
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="td-pb-span2 td-main-sidebar" role="complementary">
                            <div class="td-ss-main-sidebar">
                                <?php dynamic_sidebar( 'mittenspalten' ); ?>
                            </div>
                        </div>
                        <div class="td-pb-span4 td-main-sidebar" role="complementary">
                            <div class="td-ss-main-sidebar">
                                <?php dynamic_sidebar('hogerspalten'); ?>
                            </div>
                        </div>
                    </div>
  • This reply was modified 9 years by enestedt. Reason: code was wrong
  • This reply was modified 9 years by enestedt. Reason: code stil wrong
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.