Show Facebook Instant Articles panel on Custom Posts
-
Hi
The Facebook Instant Articles panel which shows the transformed output etc only appears on a Post page in the admin. How can I get it to show on Custom Post Types? I’m currently working to include CPT meta fields in my IA output and would like to see the transformed output on the CPT post page.
Cheers
-
Did this ever get resolved? I have the same problem and if so, I’d love to know how to fix it…
@wookietim: If you require assistance then, as per the Forum Welcome, please post your own topic.
Hey @wookietm no resolution as yet
Poo. Okay – I will try to figure it out the hard way (Poking at the code with a sharp stick) and see if I can figure it out. If so I’ll let you know.
Thanks – I’ll let you know if I work anything out at my end
same issue here any update??
I have a lead from my poking, I am not sure if this will work or not since I haven’t tried it yet but…
In the file wp-content/plugins/pagefrog/pagefrog-feed.php there is a point where it queries the posts. Unless I am totally mistaken, the problem is that it never includes a category_name in the arguments sent into wp-query.
In my case, I think I’d include the line category_name => ‘Projects’ in the $meta_query array. I think.
I have not tried this as of yet and it may not work. Waiting for someone to actually allow me to install a code editor on my work machine so I will try it after that. But I thought I’d toss it out there for others to think about and maybe tell me I am insane before I go ahead and do that.
This is ugly and probably badly done, but I ended up rolling my own RSS feed. It still needs work, obviously, since the SQL doesn’t identify between published and draft posts and it hard codes the name of the custom post type and it isn’t a plugin, but if you want to play with it, here is a bit of code you can drop into the theme directory and have a RSS feed that is accepted by FB if you call the PHP. Be gentle with it since I wrote it in about an hour right before a long weekend :
<?php
global $wpdb, $table_prefix;
if(!isset($wpdb)){
require_once(‘../../../wp-config.php’);
require_once(‘../../../wp-includes/wp-db.php’);
}
$sql = “select option_value from wp_options where option_name = ‘blogname'”;
$site_title = $wpdb->get_var($sql);
$sql = “select option_value from wp_options where option_name = ‘siteurl'”;
$site_link = $wpdb->get_var($sql);
$sql = “select option_value from wp_options where option_name = ‘blogname'”;
$site_description = $wpdb->get_var($sql);
?><rss version=”2.0″ xmlns:content=”http://purl.org/rss/1.0/modules/content/”>
<channel>
<title><?php echo $site_title; ?></title>
<link><?php echo $site_link; ?></link>
<description><?php echo $site_title; ?></description>
<lastBuildDate></lastBuildDate>
<language>English</language><?php
// fetch all published posts marked for FBIA publishing (render up to 50 valid posts)
$sql = “SELECT p.post_title as ‘title’,p.post_name as ‘slug’,p.post_name as ‘slug’,p.post_date as ‘pubdate’,u.user_nicename as ‘author’,p.post_excerpt as ‘description’,p.post_content as ‘content’ FROM wp_posts p,wp_users u WHERE p.post_author = u.id and p.post_type = ‘mies_portfolio’ order by p.post_date desc limit 0,100”;
$posts = $wpdb->get_results($sql);
foreach($posts as $post) { ?><item>
<title><?php echo $post->title; ?></title>
<link><?php echo $post->slug; ?></link>
<guid><?php echo $post->guid; ?></guid>
<pubDate>http://kicksusarc.staging.wpengine.com/<?php echo $post->slug; ?></pubDate>
<author><?php echo $post->author; ?></author>
<description><?php echo $post->description; ?></description>
<content:encoded>
<![CDATA[
<!doctype html>
<html>
<head>
<meta charset=”utf-8″>
<link rel=”canonical” href=”http://kicksusarc.staging.wpengine.com/<?php echo $post->slug; ?>”>
<link rel=”stylesheet” title=”default” href=”#”>
<title><?php echo $post->title; ?></title>
<meta property=”fb:pages” content=”647497218604444″ />
</head>
<body>
<article>
<header>
<time class=”op-published” datetime=”<?php echo $post->pubdate; ?>”><?php echo $post->pubdate; ?></time>
</header>
<p><?php echo $post->content; ?></p>
<footer>
</footer>
</article>
</body>
</html>
]]>
</content:encoded>
</item><?php } ?>
</channel>
</rss>Thanks wookietim I’ll give this a try π
The topic ‘Show Facebook Instant Articles panel on Custom Posts’ is closed to new replies.