I was trying to integrate wordpress and sweetcron to have a “lifestream” section on my wordpress based website.
First of all I created a folder named sweet (you can use everything you like)
then I tryed to integrate wordpress dynamic data (header, footer, sidebar and style) in sweetcron template.
that was pretty easy: I added this line of code:
1 | require("../wp-blog-header.php"); |
on the top of index.php in sweetcron root
Now I was able to use every template tag I needed (as well as widgets and everything else in use in wordpress) in sweetcron theme pages..
The problem was that wordpress was returning a 404 error in http headers and page title was "Page not Found"
So i created a wordpress page named Life Stream with sweet as slug.
Sweetcron homepage was safe but every internal sweetcron link (for example this) had the same 404 problem.
so I wrote this really tiny plugin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php /* Plugin Name: Sweetcron integration Plugin URI: http://cedmax.net Version: 0.1 Description: Manage Sweetcron wordpress integration Author: cedmax */ function sweetcheck() { $pagename='sweet'; $isStream = substr_count(str_replace($_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI']).'/', '/'.$pagename.'/'); if ($isStream>0) query_posts('pagename='.$pagename); } add_action('init', 'sweetcheck'); ?> |
change sweet with yoursweetcroninstallationfolder and everything should be fine.
edit I had to remove my sweetcron installation: some problems with some of the feeds I was importing and no time to fix it, but the integration is still working






Hi, Thanks for sharing…
I was trying to get this done on one of my clients website.. I appreciate your efforts..
Thanks,
CJ
Awesome stuff! I’ve been trying to do this for awhile and have gotten nowhere near along as you have. The only problem I am still having is the theme’s header info is called before the _header.php, and I keep getting hit with a Cannot modify header information – headers already sent error.
Did you have a similar problem, and if so, how did you manage to get around it?
Actually I didn’t had that problem…
I don’t know: it could be because my _header.php contains just
<?php get_header(); ?>and the same is for _footer.php (obviusly I used get_footer())…
Awesome, it worked perfectly for me.
Thanks for your help ;)
Hi,
i wonder if i can put it on my sidebar instead of a single page…
any ideas??
Thanks!
I was not able to do the opposite: use sweetcron variables and function in wp template. but I tried too little to tell if it is possible or not: my needs moved me to explore the other way integration… if you will have success let me know :-)
I’ll do it, thanks for answering!
[...] 最初に参照したサイト『cedmax.net』 要はSweetcron側にWordPressのテンプレートを持ってくるってことだろうけど、よくわからず断念。 [...]
how did u integrate wordpress dynamic data (header, footer, sidebar and style) in sweetcron template?
I’m getting a Severity: Warning
Message: Cannot modify header information – headers already sent by (output started at [WEBSITE URL]/swit/index.php:2)
Filename: libraries/Session.php
Line Number: 295
any chance u have work around this?
Thanks
you have the same problem of R. Staehlin.
I give you the same answer: I did not have that problem, probably because I totally emptied my _header.php in sweetcron theme and put there only < ?php get_header(); ?>
Hi! You’re the only place on the internet that I’ve found a reasonable and understandable explanation for what to do to get sweetcron integrated with WordPress.
I’ve followed your instructions, but I’m still getting the 404 in the page title.
http://www.organicmechanic.org/firehose/
Can you offer any other insight as to what might be causing this?
Thanks!
Check if you did these steps:
- created in your wordpress wp-admin a new page with the slug “firehose”
- created a new plugin with the code I made changing the folder “sweet” to “firehose”
nothing else comes to my mind. let me know!
Yup, did both of those steps. I bet there’s something in the .htaccess file I have to change.
mmm… strange: with your permalink configuration it should work… it may be a plugin active (or the template) that is interfering with the “query_posts” in my plugin. but it’s weird that the http header is correct (it’s 200 not 404) and only the page title is wrong. maybe (quick and dirty) you can override it with some seo plugins.
or try to debug my snippet of code printing $isStream and $pagename value to see if they match
[...] chose sweetcron and got to work. I even found a way to integrate my Wordpress theme into a sweetcron theme. This setup process was not easy and hasn’t worked completely. The sweetcron-run firehose [...]