Jump to content

Archived

This topic is now archived and is closed to further replies.

dawsonbarber

How Can I Get LoopBuddy to Work with DMS

Recommended Posts

dawsonbarber

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
Rob

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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
dawsonbarber

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
Rob

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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites

  • Similar Content

    • Steve Webb
      By Steve Webb+
      I am having an issue with DMS editor not loading.  Just keeps spinning and spinning.
      Have tried several things - Logged in and out, cleared cache, deactivated all plugins, but the issue persists.
      I even had our host restore from a backup a few weeks ago, when I know it WAS working, as I edited a text box on the homepage.  The restore from backup didn't help either.
      Also, the front end of the site shows that the site is framed, or boxed now (whatever you call it), instead of full width as it was previously (last week).
      Dev console shows that there are php errors in Google maps - file is attached.
      Can someone please help?  Not sure what else I can do here...
      Thanks in advance.
      -Matt

    • tuciudadenred
      By tuciudadenred+
      Hi everyone, what happens is that the web page metrosalarmas.com has a google tags which I have not attacked where I can look to remove those tags and be able to locate the correct ones.
    • Steve Webb
      By Steve Webb+
      I am having an issue with DMS editor not loading.  Just keeps spinning and spinning.
      Have tried several things - Logged in and out, cleared cache, deactivated all plugins, but the issue persists.
      I even had our host restore from a backup a week ago, when I know it WAS working, as I edited a text box on the homepage.  The restore from backup didn't help either.
      Also, the front end of the site shows that the site is framed, or boxed now (whatever you call it), instead of full width as it was previously (last week).
      Dev console shows that there are php errors in Google maps - file is attached.
      Can someone please help?  Not sure what else I can do here...
      Thanks in advance.
      -Matt

    • JawDesigns
      By JawDesigns
      Hi everyone,
      Flywheel have reported errors on my clients site 'www.racewaredirect.co.uk' and it's not loading. Can someone please provide some information on how to fix this? The site has never experienced these issues before.
      Thanks,
      James Wilson
    • MissT
      By MissT+
      Hi there,
      I've got an issue with 3 websites built with DMS since I migrated them from http to https that I need help with please.
      When any changes are made - e.g. new posts added or existing posts amended - certain sections of the live site seem to break e.g. image headers hang and don't load (b/g on canvas section), sliders hang and don't load (Revslider), flipper section doesn't load.
      Logging in and then clicking 'Edit the site using DMS' seems to fix the problem. Often if I try to open up another browser window to edit the site / re publish I'm unable to as the page wont load / hangs while trying to load.
      Any ideas how to fix this? On a couple of the sites I've installed a caching plugin as I thought it might be a loading speed issue but it's still happening.
      Website URL's can be provided privately.
      Many thanks in advance.
×