Forum Replies Created

Viewing 15 replies - 1 through 15 (of 26 total)
  • Thread Starter manugarrido

    (@manugarrido)

    84k images indexed and being deleted as I write…

    Impressive plugin!

    Thread Starter manugarrido

    (@manugarrido)

    Ah, so that was the impressive amount of images.

    I think that the real reason was overloading the database.

    How much space did you get back?

    in the database around 700MB.
    In httpdocs around 30GB.

    manugarrido

    (@manugarrido)

    The following custom form worked for me:

    <form id="subscription_frm" method="post" class="sml_subscribe">
    <input class="sml_hiddenfield" name="sml_subscribe" type="hidden" value="1">
    <input type="email" name="sml_email" placeholder="ENTER EMAIL ADDRESS..." required />
    <input type="submit" id="subscription_submit" value="SIGN UP" />
    </form>
    manugarrido

    (@manugarrido)

    Makes sense.

    I had a handcoded form that was being handled via php’s mail function, but now the project requires a CMS friendly solution so here I am.

    Can you tell me how did you make it work? Where did you pointed the action attribute of your custom form?

    Thanks.

    manugarrido

    (@manugarrido)

    Were you able to include the form via shortcode?

    Thread Starter manugarrido

    (@manugarrido)

    This worked for me

    DELETE FROM wp_posts
    WHERE post_parent NOT IN (
    	SELECT ID FROM (
    		SELECT ID FROM wp_posts WHERE post_type <> 'attachment'
    	) as sub_query
    )
    AND post_type = 'attachment'
    ;
    
    DELETE FROM wp_postmeta
    WHERE post_id NOT IN ( SELECT ID FROM wp_posts )
    ;
    Thread Starter manugarrido

    (@manugarrido)

    I think that I have the solution.

    SELECT a.ID, b.meta_key, b.meta_value
    FROM wp_posts a
    LEFT JOIN wp_postmeta b ON ( a.ID = b.post_id )
    WHERE a.post_parent NOT IN ( SELECT ID FROM wp_posts )
    AND a.post_type = 'attachment'
    LIMIT 999999;

    As far as I understand, this select retrieves the attachments whose related posts don’t exist, along with the related records of wp_postmeta. Am I correct?

    In case I do, converting that order in a DELETE would be safe enough to delete all orphaned attachments?

    Thread Starter manugarrido

    (@manugarrido)

    Actually, the restoration of the needed images can be done without healing the relationships.

    I made a quick script to match old and new (missing) images by eye, so the drag and dropping can start:

    <table>
    				<tr>
    					<td>#</td>
    					<td>POST ID</td>
    					<td>OLD SITE</td>
    					<td>NEW SITE</td>
    					<td>MISSING IMAGE PATH</td>
    				</tr>
    		<?php
    
    		global $post;
    		$args = array(
    			'posts_per_page' => -1,
    			'offset'=> 0,
    			'post_status' => array('publish')
    		);
    		$cnt = 0;
    		$myposts = get_posts( $args );
    		foreach ( $myposts as $post ) :
    			setup_postdata( $post );
    			$tn_id = get_post_thumbnail_id( $post->ID );
    			$img = wp_get_attachment_image_src( $tn_id, 'full' );
    			//if ( has_post_thumbnail() ) {
    				if ( !file_exists( $img[0] ) ) {
    					echo '
    						<tr>
    							<td>'.++$cnt.'</td>
    							<td>'.get_the_ID().'</td>
    							<td><center><img src="'.str_replace('https://','https://staging.',$img[0]).'" style="width:auto;height:50px;" /></center></td>
    							<td><center><img src="'.$img[0].'" style="width:auto;height:50px;"/></center></td>
    							<td><a href="'.$img[0].'" target="_blank">'.$img[0].'</a></td>
    						</tr>
    					';
    				}
    			//}
    		endforeach;
    		wp_reset_postdata(); ?>
    
    			</table>

    However the database has to be healed.

    Here mate: Forget about the plugin and…

    https://isotope.metafizzy.co/v1/demos/infinite-scroll.html

    Easy steps:

    1- Get the infinite-scroll jQuery plugin from here >> https://www.infinite-scroll.com/

    2- Include the JS into the page (index.php in my case)

    <script src="<?php echo get_template_directory_uri(); ?>/js/isotope/jquery.isotope.min.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/js/isotope/jquery.infiniteScroll.min.js"></script>

    3- Generate isotope, desired events (on window resize, etc) and implant the infinite scroll code.

    jQuery(function() {
    	// cache container
    	var jQueryContent = jQuery('#content');
    	// initialize isotope
    	jQueryContent.isotope({
    		// options...
    		itemSelector : '.tile',
    		animationEngine : 'best-available',
    		layoutMode : 'masonry',
    		masonry: {
    			columnWidth: 156,
    			rowHeight: 156
    		}
    	});
    
    	setTimeout(function(){jQueryContent.isotope('reLayout');},750);
    	setTimeout(function(){jQueryContent.isotope('reLayout');},3000);
    
    	jQuery( window ).resize(function() {
    		jQueryContent.isotope('reLayout');
    	});
    
    	var $container = $('#content');
    	$container.isotope({
    		itemSelector : '.tile'
    	});
    	$container.infinitescroll({ // next two lines work with 'twentyfourteen_paging_nav();'
    		navSelector  : '.pagination',	// selector for the paged navigation
    		nextSelector : '.next',		// selector for the NEXT link (to page 2)
    		itemSelector : '.tile',		// selector for all items you'll retrieve (probably 'isotope-item' would work)
    		loading: {
    			finishedMsg: 'No more tiles to load.',
    			img: 'https://i.imgur.com/qkKy8.gif'
    		}
    	},
    		// call Isotope as a callback
    		function( newElements ) {
    			$container.isotope( 'appended', $( newElements ) );
    		}
    	);
    });

    Any luck so far?

    I just thought about appending the new items to the existent isotope. I’ll let you know how it goes!

    I’ve the very same problem.

    I’ve been trying to invoke reLayout in the callback but doesn’t work:
    $( document ).find( "#content" ).isotope( 'reLayout' );

    Thread Starter manugarrido

    (@manugarrido)

    Woah… a month without reply

    Lol, I jumped again into the same issue… again.

    Somehow the id of the inner item to ‘navbar’ is changed; All you need to do is go to your header.php and change back the id. Mine was “navigation”.

    WordPress menu-toggle event looks for ‘site-navigation’.

    How this help someone.

    As far as I know it’s a server issue. Enqueued emails.

    Try to use another server as emailserver. There is a plugin ‘SMTP’ that allows you to login into a email and send every single mail() function from there.

    I don’t know if it’s related.

    I needed to put an extra plugin in place: SMTP. Then I configured it with the client’s email account (which is a gmail).

    Hope this helps.

Viewing 15 replies - 1 through 15 (of 26 total)