Contact Form 7 Multi-Step Slider Form

Multi Step Sliding Form

Contact Form 7 Multi-Step Slider Form
Contact Form 7 Multi-Step Slider Form

It’s been 5 years since my attempt to find a solution for a multi step sliding forms with 3 separate WordPress plugins. I had something that worked as long as the plugins were never updated. Sadly enough, my hack became outdated and useless as plugins were updated. I had a couple of people contact me recently about using my multi step sliding form. My hack works on the same page without page reloads. They did not understand when the code hack did not work. The main reason because it’s outdated.

Nobody wants a hack. They want clean, reusable and supported WordPress plugins. Well now, that is what I look for as a WordPress developer. Amazingly enough, I am developing a clean, reusable and supported WordPress plugin. I promise it will be out soon.

My experience with custom designing themes and custom plugin development has given me a toolbox of awesomeness. I have 17 years of knowledge as a web developer. In those years, I have learned modern web development and best practices.

 

 

 

Advertisements

Paginate Multisite Attachment WP_Query

I am working on a multisite blog network where I need to display x post per page and navigation at the of the bottom list. My code will not display a pagination at the bottom and displays x post per page after every multisite blog loop. I have tried moving the WordPress function paginate_links() outside the foreach loop and without success. Does anybody have a fix or workaround?

// Iterate through your list of blogs
foreach ($blog_ids  as $id){

// Switch to the next blog in the loop.    
switch_to_blog($id);
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array (                 
    'posts_per_page'        => $limit,
    'paged'                 => $paged,      
    'post_type'             => 'attachment',        
    'post_status'           => 'inherit',       
    'post_mime_type'        => 'application/pdf',
    'order'                 => 'ASC'
);

$pdf_attachments = query_posts( $args );

// See if there are PDF attachments.
if( have_posts() )
{   

    while( have_posts()) { the_post();

        $title = get_the_title( $pdf_attachments->blog_id );

        $url = wp_get_attachment_url( $pdf_attachments->blog_id );                          

        $list .= '<li>' 

        .'<a href="'. $url .'" title="' . $title . '" class="pdf" target="_blank">'. $title .'</a>'

        .'</li>';

    }           

    // Switch back to the main blog
    restore_current_blog();
}

return '<ul class="unstyled">' 
    . $list 
    . '</ul>' 
    . paginate_links( array(
            'base' => '%_%',                                
            'format' =>  $slug .'/page/%#%',
            'add_args' => array(
                'searchterm' => get_query_var('s'),
                'limit' => get_query_var('posts_per_page')
            )
        )
    );
}

You’re in luck! I have been working on a solution. Finally here is a version of my solution. I hope this helps anybody that is stuck with a WPMU plugin development that needs a pager.

<?php 
function network_pager() 
{
	
	global $post;		
	
	$blog_name = $blog_count = $searchterm = $list = ''; 
	
	$site_names = $get_site_names = $blog_id = $get_blog_ids = array();
	
	$searchterm =  $_GET['searchterm'];
	
	$limit = 20;
	
	$current_site = get_bloginfo('url');		
	
	$slug = $current_site. '/' .get_post( $post )->post_name;		
		
	$current_blog_id = get_current_blog_id();	
	
	$selected_blog = ( isset($_GET['selected_blog']) && $_GET['selected_blog'])? $_GET['selected_blog']: $current_blog_id;	
	
	$args = array(
		
		'network_id' => $wpdb->siteid
		
	);
	
	// array of blogs
	$network_site_ids = wp_get_sites( $args ); 
	
	foreach( $network_site_ids as $key => $network_site ) 
	{
			
		$blog_id = $network_site['blog_id'];
		
		$blog_title = get_bloginfo('name');
		
		$site_names = get_blog_details($blog_id);		
		
		$get_site_names[$key] = $site_names->blogname;				
		
		$get_blog_ids[$key] = $site_names->blog_id;
		
	}
		
	if( isset($selected_blog)) {				
			
		global $wpdb;
		
		switch_to_blog( $selected_blog );				
		
		$blog_details = get_blog_details( $selected_blog );
		
		$blog_name = $blog_details->blogname;
		
		$paged = get_query_var('paged') ? get_query_var('paged') : 1;				
			
		$orderby = 'name';				
		
		$args = array ( 
		
			'posts_per_page' 		=> $limit,
			
			'paged' 				=> $paged,
			
			'post_type' 			=> 'attachment',
			
			'post_status' 			=> 'inherit',
			
			'post_mime_type' 		=> 'application/pdf',			
			
			's'						=> $searchterm,
			
			'orderby'               => $orderby,
			
			'order'                 => 'ASC'
			
		);
			
		$pdf_attachments = query_posts( $args );				
		
		$query2 = new WP_Query( $args );
	
		// See if there are PDF attachments.
		if( have_posts() )
		{ 	
									
			while( have_posts()) { the_post();
				
				$title = get_the_title( $pdf_attachments->blog_id );
				
				$url = wp_get_attachment_url( $pdf_attachments->blog_id );							
			
				$list .= '<li>'	
				
				.'<a href="'. $url .'" title="' . $title . '" class="mtli_attachment mtli_pdf" target="_blank">'. $title .'</a>'
				
				.'</li>';

			}
			
			restore_current_blog();				
			
			$output .= '<div class="container clearfix">'
			
			. '<ul class="listings unstyled">' . $list . '</ul>'
			
			. '<!-- pagination here -->'

			.'<div class="pager_wrapper">'
			
			. paginate_links( array(
					'base' => '%_%',								
					'format' =>  $slug .'/page/%#%',
					'add_args' => array(
						'searchterm' => get_query_var('s'),
						'category' => get_query_var('media_category'),
						'limit' => get_query_var('posts_per_page'),
						'selected_blog' => $selected_blog
					)
				)
			)
													
			.'</div>'						         
			
			.'</div>'
			
			. wp_reset_query(); // end return					
		
		}
		else { 
			
			$output .= "<li>We're Sorry! We do not have PDFs for this department.</li>";
			
		}
		
	}
	
	return $output;			
			
}