<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>

		<title>Registering Custom Post Types and Displaying in Recent Posts &#8211; Themeco Community</title>
		<atom:link href="https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/feed/" rel="self" type="application/rss+xml" />
		<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/feed/</link>
		<description></description>
		<lastBuildDate>Sun, 12 Oct 2025 23:30:23 +0000</lastBuildDate>
		<generator>https://bbpress.org/?v=2.6.14</generator>
		<language>en-US</language>

		
														
					
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-309477</guid>
					<title><![CDATA[Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-309477</link>
					<pubDate>Mon, 22 Jun 2015 15:34:47 +0000</pubDate>
					<dc:creator>glennyboy</dc:creator>

					<description>
						<![CDATA[
						<p>Hi</p>
<p>Additional Custom Posts types don&#8217;t seem to appear/register in X Theme or are not available in the &#8216;Recent Posts&#8217; widget? I only ever see &#8216;Posts&#8217; and &#8216;portfolio&#8221;?</p>
<p>Thanks</p>
<p>Glennyboy`</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-309512</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-309512</link>
					<pubDate>Mon, 22 Jun 2015 16:24:41 +0000</pubDate>
					<dc:creator>glennyboy</dc:creator>

					<description>
						<![CDATA[
						<p>&#8230; also the Recent Posts plugin and associated shortcake ate limited to 4 posts whereas I need to show x posts or &#8216;Show All&#8217;. How can I achieve that also please?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-309590</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-309590</link>
					<pubDate>Mon, 22 Jun 2015 17:40:48 +0000</pubDate>
					<dc:creator>Thai</dc:creator>

					<description>
						<![CDATA[
						<p>Hi There,</p>
<p>Thanks for writing in.</p>
<p>This is only possible if you override the <strong>x_recent_post </strong>shortcode by customizing your own. Please use following PHP code in your child theme’s <strong>functions.php</strong> file:</p>
<pre><code>
function x_shortcode_recent_posts_override( $atts ) {
  extract( shortcode_atts( array(
    &#039;id&#039;          =&gt; &#039;&#039;,
    &#039;class&#039;       =&gt; &#039;&#039;,
    &#039;style&#039;       =&gt; &#039;&#039;,
    &#039;type&#039;        =&gt; &#039;post&#039;,
    &#039;count&#039;       =&gt; &#039;&#039;,
    &#039;category&#039;    =&gt; &#039;&#039;,
    &#039;offset&#039;      =&gt; &#039;&#039;,
    &#039;orientation&#039; =&gt; &#039;&#039;,
    &#039;no_image&#039;    =&gt; &#039;&#039;,
    &#039;fade&#039;        =&gt; &#039;&#039;
  ), $atts, &#039;x_recent_posts&#039; ) );

  $allowed_post_types = apply_filters( &#039;cs_recent_posts_post_types&#039;, array( &#039;post&#039; =&gt; &#039;post&#039;, &#039;your-post-type&#039; =&gt; &#039;your-post-type&#039; ) );
  $type = ( isset( $allowed_post_types[$type] ) ) ? $allowed_post_types[$type] : &#039;post&#039;;

  $id            = ( $id          != &#039;&#039;          ) ? &#039;id=&quot;&#039; . esc_attr( $id ) . &#039;&quot;&#039; : &#039;&#039;;
  $class         = ( $class       != &#039;&#039;          ) ? &#039;x-recent-posts cf &#039; . esc_attr( $class ) : &#039;x-recent-posts cf&#039;;
  $style         = ( $style       != &#039;&#039;          ) ? &#039;style=&quot;&#039; . $style . &#039;&quot;&#039; : &#039;&#039;;
  $count         = ( $count       != &#039;&#039;          ) ? $count : 3;
  $category      = ( $category    != &#039;&#039;          ) ? $category : &#039;&#039;;
  $category_type = ( $type        == &#039;post&#039;      ) ? &#039;category_name&#039; : &#039;portfolio-category&#039;;
  $offset        = ( $offset      != &#039;&#039;          ) ? $offset : 0;
  $orientation   = ( $orientation != &#039;&#039;          ) ? &#039; &#039; . $orientation : &#039; horizontal&#039;;
  $no_image      = ( $no_image    == &#039;true&#039;      ) ? $no_image : &#039;&#039;;
  $fade          = ( $fade        == &#039;true&#039;      ) ? $fade : &#039;false&#039;;

  $js_params = array(
    &#039;fade&#039; =&gt; ( $fade == &#039;true&#039; )
  );

  $data = cs_generate_data_attributes( &#039;recent_posts&#039;, $js_params );

  $output = &quot;&lt;div {$id} class=\&quot;{$class}{$orientation}\&quot; {$style} {$data} data-fade=\&quot;{$fade}\&quot; &gt;&quot;;

    $q = new WP_Query( array(
      &#039;orderby&#039;          =&gt; &#039;date&#039;,
      &#039;post_type&#039;        =&gt; &quot;{$type}&quot;,
      &#039;posts_per_page&#039;   =&gt; &quot;{$count}&quot;,
      &#039;offset&#039;           =&gt; &quot;{$offset}&quot;,
      &quot;{$category_type}&quot; =&gt; &quot;{$category}&quot;,
      &#039;&#039;
    ) );

    if ( $q-&gt;have_posts() ) : while ( $q-&gt;have_posts() ) : $q-&gt;the_post();

      if ( $no_image == &#039;true&#039; ) {
        $image_output       = &#039;&#039;;
        $image_output_class = &#039;no-image&#039;;
      } else {
        $image              = wp_get_attachment_image_src( get_post_thumbnail_id(), &#039;entry-cropped&#039; );
        $bg_image           = ( $image[0] != &#039;&#039; ) ? &#039; style=&quot;background-image: url(&#039; . $image[0] . &#039;);&quot;&#039; : &#039;&#039;;
        $image_output       = &#039;&lt;div class=&quot;x-recent-posts-img&quot;&#039; . $bg_image . &#039;&gt;&lt;/div&gt;&#039;;
        $image_output_class = &#039;with-image&#039;;
      }

      $output .= &#039;&lt;a class=&quot;x-recent-post&#039; . $count . &#039; &#039; . $image_output_class . &#039;&quot; href=&quot;&#039; . get_permalink( get_the_ID() ) . &#039;&quot; title=&quot;&#039; . esc_attr( sprintf( __( &#039;Permalink to: &quot;%s&quot;&#039;, csl18n() ), the_title_attribute( &#039;echo=0&#039; ) ) ) . &#039;&quot;&gt;&#039;
                 . &#039;&lt;article id=&quot;post-&#039; . get_the_ID() . &#039;&quot; class=&quot;&#039; . implode( &#039; &#039;, get_post_class() ) . &#039;&quot;&gt;&#039;
                   . &#039;&lt;div class=&quot;entry-wrap&quot;&gt;&#039;
                     . $image_output
                     . &#039;&lt;div class=&quot;x-recent-posts-content&quot;&gt;&#039;
                       . &#039;&lt;h3 class=&quot;h-recent-posts&quot;&gt;&#039; . get_the_title() . &#039;&lt;/h3&gt;&#039;
                       . &#039;&lt;span class=&quot;x-recent-posts-date&quot;&gt;&#039; . get_the_date() . &#039;&lt;/span&gt;&#039;
                     . &#039;&lt;/div&gt;&#039;
                   . &#039;&lt;/div&gt;&#039;
                 . &#039;&lt;/article&gt;&#039;
               . &#039;&lt;/a&gt;&#039;;

    endwhile; endif; wp_reset_postdata();

  $output .= &#039;&lt;/div&gt;&#039;;

  return $output;
}
add_action(&#039;init&#039;, &#039;x_overwrite_shortcode&#039;);
function x_overwrite_shortcode() {
  remove_shortcode( &#039;x_recent_posts&#039; );
  add_shortcode( &#039;x_recent_posts&#039;, &#039;x_shortcode_recent_posts_override&#039; );
}
</code></pre>
<p>You can replace the <strong>your-post-type</strong> with your new post type slug.</p>
<p><em>… also the Recent Posts plugin and associated shortcake ate limited to 4 posts whereas I need to show x posts or ‘Show All’. How can I achieve that also please?</em></p>
<p>=&gt; Usage: <strong>[x_recent_posts count=&#8221;-1&#8243; type=&#8221;your-type&#8221;]</strong></p>
<p>Hope it helps.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-310328</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-310328</link>
					<pubDate>Tue, 23 Jun 2015 10:56:14 +0000</pubDate>
					<dc:creator>glennyboy</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Guys</p>
<p>Can you look to add this as a feature to &#8216;element&#8217; as having a restriction to 4 posts is very limiting.</p>
<p>I figured out the shortcake with -1 but actually what the output then does is bunch posts up with responsive sizing issues. </p>
<p>In relation to specifying post type in shortcode- my test it simply defaults to &#8216;posts&#8217; and again I think that has something to do with a post registration issue into X. Not 100% but that does seem to be the case as &#8216;posts&#8217; and &#8216;portfolio&#8217; do show &#8211; nothing else.</p>
<p>Right now as I want adopt &#8216;out of the box elements&#8217; what I am doing is adding multiple recent post elements and adding an incremental +4 on each. That creates a pseudo layout which is by no means ideal, but it&#8217;s the best method for consistent layout right now.</p>
<p>Cheers</p>
<p>Glennyboy</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-310481</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-310481</link>
					<pubDate>Tue, 23 Jun 2015 13:06:04 +0000</pubDate>
					<dc:creator>Zeshan</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Glennyboy,</p>
<p>We certainly appreciate the feedback! This is something we can add to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive. </p>
<p>In regard to the custom post types, right now, Recent Posts shortcode only work with posts and &#8220;X Portfolio&#8221; post type. Integrating a different custom post type might be possible with custom development and given above, but would be outside the scope of support we can offer you. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities. </p>
<p>Thanks for understanding. </p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-351165</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-351165</link>
					<pubDate>Wed, 05 Aug 2015 19:57:08 +0000</pubDate>
					<dc:creator>motivteam</dc:creator>

					<description>
						<![CDATA[
						<p>Hi&#8211;just chiming in to say that I am also having the issue where I added the above code into my Functions file (customized according to directions), but the custom post type still won&#8217;t display. Agree with Glennyboy, this be an awesome addition if possible! </p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-351276</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-351276</link>
					<pubDate>Wed, 05 Aug 2015 22:05:08 +0000</pubDate>
					<dc:creator>Lely</dc:creator>

					<description>
						<![CDATA[
						<p>Hello There,</p>
<p>Would you mind providing us with login credentials so we can take a closer look to your settings? To do this, you can make a post with the following info:</p>
<p>&#8211; Link to your site<br />
&#8211; WordPress Admin username / password<br />
&#8211; FTP credentials</p>
<p><strong>Don&#8217;t forget to select Set as private reply. This ensures your information is only visible to our staff. </strong></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-745560</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-745560</link>
					<pubDate>Thu, 14 Jan 2016 07:51:25 +0000</pubDate>
					<dc:creator>Milton</dc:creator>

					<description>
						<![CDATA[
						<p>Hi guys, </p>
<p>I&#8217;m also trying to use some Custom Post Types in recent posts. But it&#8217;s unclear to me if the code shown on this post is supposed to work. I have included it but with no results. Is there anything else that needs to be done?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-745578</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-745578</link>
					<pubDate>Thu, 14 Jan 2016 08:12:13 +0000</pubDate>
					<dc:creator>Rue Nel</dc:creator>

					<description>
						<![CDATA[
						<p>Hello Milton,</p>
<p>Because this requires a template change, I&#8217;d advise that you setup a <a href="https://community.theme.co/kb/how-to-setup-child-themes/" title="Child Themes" target="_blank" rel="nofollow">child theme</a>. This allows you to make code changes that won&#8217;t be overwritten when an <strong>X</strong> update is released. After your child theme is setup, please review how we recommend making template changes in <a href="https://community.theme.co/kb/customization-best-practices/" rel="nofollow">Customization Best Practices</a>.</p>
<p>Once the child theme is active and ready, please add the following  code in your child theme&#8217;s functions.php</p>
<pre><code>function add_event_post_type( $types ) {
  $types[&#039;post_type_name&#039;] = &#039;post_type_name&#039;;
  return $types;
}
add_filter( &#039;cs_recent_posts_post_types&#039;, &#039;add_event_post_type&#039;, 999 );</code></pre>
<p>If you have place the code right, you should be able to get something like this:<br />
<img decoding="async" src="http://i.imgur.com/522Kf4J.png" alt="" /></p>
<p>We would loved to know if this has work for you. Thank you.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-802779</guid>
					<title><![CDATA[Reply To: Registering Custom Post Types and Displaying in Recent Posts]]></title>
					<link>https://theme.co/archive/forums/topic/registering-custom-post-types-and-displaying-in-recent-posts/#post-802779</link>
					<pubDate>Fri, 19 Feb 2016 05:13:02 +0000</pubDate>
					<dc:creator>k8.peterson</dc:creator>

					<description>
						<![CDATA[
						<p>Just wanted to say that it took me figuring out that the child theme that came with X was broken, but using these two code chunks together worked for me. </p>
<p>for the second one (function add_event_post_type), switch &#8216;post_type_name&#8217; with  your post slug. as opposed to the first, which is &#8216;your-post-type&#8217; &#8211; pretty simple but could trip someone up. </p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

