lostmonkey
Forum Replies Created
-
Forum: Networking WordPress
In reply to: Aggregating Recent Posts to Parent Site in Multisite Install@andrea_r I suspect it’s simply an IIS7 server configuration issue on my part. I’ll let the authors know if I find out otherwise. Thanks!
Forum: Networking WordPress
In reply to: Aggregating Recent Posts to Parent Site in Multisite InstallFunny how easy it can be to over look the simplest things. I found page two of this forum after I figured out how to use @godlike ‘s posted code which is what I’m about to share.
I did look into both Sitewide, and List-recent-sites but not in great depth. Both plugins caused server errors. List-recent-sites more specifically caused me to not have access to only my plugins page in the dashboard immediately after installing the plugin. I’m going to look into these issues more as I’d like to use the plugin for future projects. For the time being, I found it easier to work with @godlike ‘s code.
Original Code Posted by @godlike [Pastebin] [WP_Forum]
Reference Site [kandar.info]
How to Setup Code
- Simply paste the code as is into your functions.php file.
How to Use Code [@Phoat, @-interested-parties]
Very Basic Example-
Use the following in any custom-template.php, statichhome.php, or index.php where you want the list of multisite posts to appear:
$latest_posts = wpmu_latest_post(); foreach($latest_posts as $latest_post){ echo '<p>' . $latest_post->post_title . '</p>'; }
Return:
- Post ID = $latest_post->ID
- GUID = $latest_post->post_url
- Post Title = $latest_post->post_title
- Post Date = $latest_post->post_date
- Post Time = $latest_post->post_time
- Post Content = $latest_post->post_content
- Comment Count = $latest_post->comment_count
- Author Blog Url = $latest_post->author_blog_url
- Author Url = $latest_post->author_url
- Author Email = $latest_post->author_email
- Author Name = $latest_post->author_name
Other Notes:
This is a farily configurable script. I was able to add the excerpt to the array and create an excerpt Return ( $latest_post->post_excerpt ) without any problems . Further, I was able to setup my custom admin page on the Mainsite to control the number of posts provided on the news feed. This script by default only retrieves and sorts the recent posts from the multisites. However, a few lines of code allowed me to add the mainsite as part of that post retrieval. Lastly, I was able to limit the script to only 5 specific multisites out of the 100+.
This script, when styled correctly, can look identical to what a basic wordpress loop produces for individual sites (except it does it for all of your sites of course). I’d really like to see wordpress develop functions which can filter a wordpress loop (much like “if(in_category(‘cat-slug-name’))” ) and auto retrieve all posts from a multisite installation instead of needing a plugin. But, atleast in the meantime, this works very darn close.
Lastly, this script does not call for the Categories nor Tags associated with the multisite posts. It also doesn’t call for any Featured Images. This actually looks to be a little more involved to setup with the current code.
UPDATE: I noticed a mistake on my previous post, but it shouldn’t matter, as it appears to work as posted above. Nonetheless…
Change:
url="(^[_0-9a-zA-Z-]+/)?(wp
To:
url="^([_0-9a-zA-Z-]+/)?(wp
In regards to the url=”{R:2}” and url=”{R:1}” I discovered something interesting the otherday. If you use the code snipet I provided for rule 5, then you MUST use {R:2} . Using the snipet above in conjunction with {R:1} leaves you with the same problem which brought us all to this forum in the first place. However, if you do not use the “(…)?” method I’ve provided above, and simply left those as they were, then you can achieve the same result by simply changing {R:2} to {R:1} – In otherwords, the following two statement for Rule 5 corrected my problem in the same exact way:
Option 1:
<rule name="WordPress Rule 5" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule>
Option 2:
<rule name="WordPress Rule 5" stopProcessing="true"> <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:1}" /> </rule>
@andrea_r I’ll see what I can do when I get time. I would love to help ??
@plundquist np let me know how things turn out!
Hopefully you’ve resolved your issue. I ran across your post, and while my windows IIS7 server situation isn’t identical to yours, my problem was.
- Styles For MultiSites were messed up, though, the styles for the primary installation worked fine.
- Accessing a Dashboard to any MultiSite would give me a 500 error. No way to access them. Though, the primary installation’s dashboard worked fine.
Here’s what worked for me. Countless web-searches for “How to Setup WordPress Multisite IIS7” kept giving the SAME rewrite rules for the web.config file – except for one. [REF: Lauragentry.com]
The following is a copy of the full web.config file which caused my errors:
Pastebin: [Code Which Caused Errors]
The following is a copy of Rule 5 of the web.config file which, by itself, caused my errors.
<rule name="WordPress Rule 5" stopProcessing="true"> <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule>
It really seemed to come down to syntax. I had to modify Rule 5 to include a pair of Parentheses and a Question mark… “(…)?. So, I changed rule 5 to look like the following:
<rule name="WordPress Rule 5" stopProcessing="true"> <match url="(^[_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule>
I also found a post where the {R:2} portion of rule 5 was changed to {R:1} . This wasn’t needed in my case, but it was posted relatively around the same time (3 months ago), and involved rule 5. Check It Out Here.
Hope it helps. If you need more bananas, just ask.