• 0
Sign in to follow this  
Followers 0

How Can I Get LoopBuddy to Work with DMS


Question

Posted · Report post

Howdy DMS-ers

 

In order for any theme to fully support LoopBuddy, there are three things that need to be done (this all comes from WebDesign.com's most recent WordPress developer course).

 

I'm stuck with the third and am hoping for some assistance.

 

First, you need to add theme support to the functions.php file:

add_theme_support('loop-standard');

Then you need to add the following two functions to the functions.php file:

if ( ! function_exists( 'dynamic_loop' ) ) {
	function dynamic_loop() {
		global $dynamic_loop_handlers;
		if ( empty( $dynamic_loop_handlers ) || ! is_array( $dynamic_loop_handlers ) )
			return false;
		ksort( $dynamic_loop_handlers );
		foreach ( (array) $dynamic_loop_handlers as $handlers ) {
			foreach ( (array) $handlers as $function ) {
				if ( is_callable( $function ) && ( false != call_user_func( $function ) ) ) {
					return true;
				}
			}
		}
		return false;
	}
}
if ( ! function_exists( 'register_dynamic_loop_handler' ) ) {
	function register_dynamic_loop_handler( $function, $priority = 10 ) {
		global $dynamic_loop_handlers;
		if ( ! is_numeric( $priority ) )
			$priority = 10;
		if ( ! isset( $dynamic_loop_handlers ) || ! is_array( $dynamic_loop_handlers ) )
			$dynamic_loop_handlers = array();
		if ( ! isset( $dynamic_loop_handlers[$priority] ) || ! is_array( $dynamic_loop_handlers[$priority] ) )
			$dynamic_loop_handlers[$priority] = array();
		$dynamic_loop_handlers[$priority][] = $function;
	}
}

Finally, you need to find the WordPress loop in the theme and wrap it in the code, as follows:

<?php if (!dynamic_loop()) : ?>
	ORIGINAL LOOP
<?php endif; ?>

I'm thinking that it needs to wrap around the following (from the includes/class.posts.php file):

	function load_loop(){

		if( have_posts() )
			while ( have_posts() ) : the_post();  $this->get_article(); endwhile;
		else
			$this->posts_404();

	}

But my site breaks no matter how it wrap it up.

 

Can anyone please point me in the right direction?

 

Cheers

 

Dawson

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

Posted · Report post

Hi Dawson,

 

Sorry for the delay getting to you.  I've been trying to find out how to reply to this, and ultimately, it requires so much customization that I can't answer it properly.

 

My question is, and please forgive my ignorance, wouldn't something like Special Recent Posts work just as well, without coding the loop?

 

I am afraid that in doing this, you'd mess up a myriad of other things.

 

To implement it, you'd need a professional developer, and this will be expensive. I couldn't even recommend one of our pros for a thing like this -- wouldn't know whom to suggest.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hey Rob

 

No worries on the delay. I know you guys have been flatout for a while now so no need to apologize.

 

What I'm doing is a little out there - in that it involves several different Custom Post Types (with a lot of different custom fields) that are using LoopBuddy for some custom queries and custom layouts, all wrapped up inside of schema.org markup.

 

LoopBuddy does work with any theme. I just can't set the Custom Post Types I've created to use the custom queries and layouts I created using LoopBuddy as the defaults for those pages.

 

I can, however, get everything working using shortcodes and the LoopBuddy sidebar widget.

 

Anyway, not 100% the way I want it to be, but it's working so I think I'll leave well enough alone for now.

 

Thanks for getting back to me on this.

 

Cheers

 

Dawson

 

 

 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny's usually spot-on with that sorta thing.  It would seem you could, provided you have the proper function to add and you're using a child theme.  If you don't have one yet, the last line of the first post I created here will give you two options:  http://forum.pagelines.com/topic/28267-pay-attention-you-need-this-info/

 

Both are free.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0