Can someone please help me out. I'm looking for a way to force chrome to display my rss feed in a more user friendly way. I know chrome doesnt support this by default but I've seen websites like BBC (http://feeds.bbci.co.uk/shared/bsp/xsl/rss/nolsol.xsl) doing it.
I'm using drupal 7 views to generate the rss feed so anything I do will need to be done by modifying the views-view-rss.tpl.php file which looks as follows:
<?php print "<?xml"; ?> version="1.0" encoding="utf-8" <?php print "?>"; ?>
<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>
<channel>
<title><?php print $title; ?></title>
<link><?php print $link; ?></link>
<description><?php print $description; ?></description>
<language><?php print $langcode; ?></language>
<?php print $channel_elements; ?>
<?php print $items; ?>
</channel>
</rss>
You can always use view-source: prefix, will work for every feed.
For example, if your feed has url http://feeds.guardian.co.uk/theguardian/rss, you can type view-source:http://feeds.guardian.co.uk/theguardian/rss in your Chrome's address bar, and it will display you its full XML.
Also, when viewing a formatted feed (after clicking on RSS icon/link on a page), there is a "Feed" link in the top right corner (on the "Feed preview" blue bar) which takes you to exactly the same view-source: page.
You probably want to use XSL, which requires a minor change to this views template... and a lot of XSL.
<?php print "<?xml"; ?> version="1.0" encoding="utf-8" <?php print "?>"; ?>
<?xml-stylesheet href="/css/rss20.xsl" type="text/xsl"?>
<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>
I find XSL to be obnoxious, but you can probably just based yours off of something you find on the web. Your BBC link is a good start, or NY Times has a fine one too: view-source:http://feeds.nytimes.com/css/rss20.xsl
Related
I am using underscore to develop a wordpress theme.
I have a custom post type name project, thus I have, for instance, this url: http://a.site.local/projects/a-beauty/.
I have in my template-parts/ directory the file content-projects.
$ cat template-parts/content-projects.php
<h1>Project</h1>
When I browse http://a.site.local/projects/a-beauty/, I have my title but also the sidebar and the footer (even if they do not appear in my content-project.php nor in index.php).
Where are those widgets coming from / loaded ?
Add conditions to the header, footer and sidebar.
For whole custom post archive:
<?php if( !is_post_type_archive( 'project' ) ) : ?>
// wrap the code you don't want to show on that archive
<?php endif; ?>
For custom post only:
<?php if( !is_singular( 'project' ) ) : ?>
// wrap the code you don't want to show on the post
<?php endif; ?>
If you want to put the code you WANT to show, remove the '!' before condition.
P.S.
You can put the whole content in a condition, but keep the
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
otherwise the page will break :)
Please share some more code from your project so we can easy to understand the real problem.
while writing wp_title(), next_post_link() and previous_post_link() a special character comes, i.e. "«". How to get rid of this character?
wp_title
You can use something like <title><?php wp_title(''); ?></title> to remove the separator.
previous_post_link
If you need to remove the «, you can just simply override it like this
<?php previous_post_link('%link'); ?>
next_post_link
If you need to remove the », you can just simply override it like this
<?php next_post_link('%link'); ?>
I'm trying to build a custom RSS feed from scratch, and want to include an image that I can pull out using Mailchimp.
So my current RSS item looks like this:
<item>
<link><?php echo get_permalink($beforeAfter->procedureID); ?></link>
<media:content url="<?php echo get_bloginfo('url').'/wp-content/uploads/before-after/md/'.$beforeAfter->after_img;?>" type="image/jpg" />
<?php rss_enclosure(); ?>
<?php do_action('rss2_item'); ?>
</item>
But when I view it, I get the error:
error on line 15 at column 124: Namespace prefix media on content is
not defined
If I remove the <media:content> line, the error goes away. Any ideas why the error is appearing, and why it won't read it correctly?
Here are some links I'm using for reference:
http://www.rssboard.org/media-rss#media-content
http://kb.mailchimp.com/merge-tags/rss-blog/feedblock-rss-merge-tags
See http://www.rssboard.org/media-rss#namespace-declaration:
The namespace for Media RSS is defined to be http://search.yahoo.com/mrss/
For example:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
Include the xmlns:media declaration on one of the parent elements of the <media:content/> element.
I couldn't find an answer to this question anywhere and I have a hard time believing I'm the only one who has had this problem.
My title function inside my title tag of header.php, <?php wp_title('|', true, 'right'); ?>, is returning the page title but not the site title.
Example: About Us |
Why would it not be returning the site name??
Looks like wp_title() does not return the site's title. Sorry, hopefully someone will benefit from this answer.
I've never tried combining the entire title inside one function. Instead I use multiple calls:
<?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' |'; } ?> <?php bloginfo('name'); ?>
EDIT SOLVED The code <?php ob_start(); ?> put before any other output seemed to solve the problem.
I have a problem with errors appearing on a page on my site.
I am including 3 php files before any HTML output which is.
<?php
include_once("rpw_includes/dtd_site_root.php");
include_once("rpw_includes/dtd_remote_module_classes.php");
include_once("rpw_includes/rpw_remote_module_classes.php");
?>
<!DOCTYPE html>
<head>
That code is in my header.php file and all works fine on my index file but when i go onto another page which also calls the same header file i get these errors.
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\barnet\wp-content\themes\barnet\search-results.php:7) in C:\xampp\htdocs\barnet\wp-content\themes\barnet\rpw_includes\dtd_remote_module_classes.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\barnet\wp-content\themes\barnet\search-results.php:7) in C:\xampp\htdocs\barnet\wp-content\themes\barnet\rpw_includes\dtd_remote_module_classes.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\barnet\wp-content\themes\barnet\search-results.php:7) in C:\xampp\htdocs\barnet\wp-content\themes\barnet\rpw_includes\dtd_remote_module_classes.php on line 17
Any ideas?
EDIT*
search-results.php
<?php
/*
Template Name: Search Results
*/
?>
<?php ob_start(); ?>
<?php get_header(); ?>
<div id="page-search-hold">
<Div id="page-search"></div>
</div>
<?php
$module_obj= new RPW_results_obj();
$module_obj->write_html();
?>
<?php get_footer(); ?>
With the ob_start(); added the errors dissapear but i get about a 20px margin before my body starts like there should be erros but they are just not showing?
Make sure that the other page that includes header.php has the include as the very first line.