Total images are not showing in uploads using filezilla and coreFTP in wordpress

CoreFTP and filezilla having limit to show files in folder.

Using File Manager  plugin we’ll download every file.

Check below screenshot.

screenshot-1

 

Read files from directory and copy / move to another directory using php

<?php

/* For wordress */
$upload_dir = wp_upload_dir();
$dir = $upload_dir[‘basedir’].”/2015/11/”;
$dest_dir = $upload_dir[‘basedir’].”/developer/”;

/* For PHP */
$dir = “/source”;
$dest_dir = “/destination/”;

if (is_dir($dir)){
if ($dh = opendir($dir)){ $i=1; $cou = 0;
while (($file = readdir($dh)) !== false){
if (( $file != ‘.’ ) && ( $file != ‘..’ )) {
/* Copy files */
copy($dir . $file,$dest_dir . $file);
$i++;
/* Move files */
rename($dir . ‘/’ . $file, $dest_dir . ‘/’ . $file);
}

}
closedir($dh);
}
}
?>

Window scroll event in jQuery

jQuery(document).ready(function(){

jQuery(window).scroll(function() {

var het = jQuery(window).scrollTop();

if(het>130){

jQuery(“.logo_with_newlik”).show();

}

else{

jQuery(“.logo_with_newlik”).hide();

}

});

});

Store string with quotes in MySQL using PHP new version

<?php

/* Database connect using mysqli */

$dbHost = ‘localhost’;
$dbUsername = ‘root’;
$dbPassword = ”;
$dbName = ‘test’;
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
if ($db->connect_errno) {
printf(“Connect failed: %s\n”, $db->connect_error);
exit();
}

/* Solve quotes issue using “addslashes” function in PHP. */ 

$str = “Is your name O’Reilly?”;

// Outputs: Is your name O\’Reilly?

$str = addslashes($str);

$query = “INSERT INTO table VALUES (‘$str’)”;
$sql = $db->query($query);
?>

Woocommerce – Work with product categories

<?php

/*
* Woocommerce – Work with categories
*/
if ( is_product_category() ){ // Condition for product category
global $wp_query;
$cat = $wp_query->get_queried_object();
$current_cat_id = $cat->term_id;
$cat_parent = $cat->parent; // get category parent

/* Get childrens of category */
$children = get_categories( array (‘taxonomy’ => ‘product_cat’, ‘parent’ => $current_cat_id ));

/*Get category link*/
$cat_link = get_category_link( $current_cat_id );

}

/*Get categories based on product id*/
$terms = get_the_terms( $post->ID, ‘product_cat’ );
foreach ($terms as $term) {
$product_cat = $term->name;
break;
}

?>

WooCommerce – working on tabs in product page

<?php
/*
* Put below codes in current theme functions.php
* Woocommerce shortcodes
*/

/*
* Removing Tabs
* Use the following snippet to remove specific tabs
*/

add_filter( ‘woocommerce_product_tabs’, ‘woo_remove_product_tabs’, 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs[‘description’] ); // Remove the description tab
unset( $tabs[‘reviews’] ); // Remove the reviews tab
unset( $tabs[‘additional_information’] ); // Remove the additional information tab
return $tabs;
}

/*
* Renaming Tabs
* Use the following snippet to rename tabs.
*/

add_filter( ‘woocommerce_product_tabs’, ‘woo_rename_tabs’, 98 );
function woo_rename_tabs( $tabs ) {
$tabs[‘description’][‘title’] = __( ‘More Information’ ); // Rename the description tab
$tabs[‘reviews’][‘title’] = __( ‘Ratings’ ); // Rename the reviews tab
$tabs[‘additional_information’][‘title’] = __( ‘Product Data’ ); // Rename the additional information tab
return $tabs;
}

/*
* Re-ordering Tabs
* Use the following snippet to change the tab order
*/

add_filter( ‘woocommerce_product_tabs’, ‘woo_reorder_tabs’, 98 );
function woo_reorder_tabs( $tabs ) {
$tabs[‘reviews’][‘priority’] = 5; // Reviews first
$tabs[‘description’][‘priority’] = 10; // Description second
$tabs[‘additional_information’][‘priority’] = 15; // Additional information third
return $tabs;
}

/*
* Customise a tab
* The following snippet will replace the description tab with a custom function
*/

add_filter( ‘woocommerce_product_tabs’, ‘woo_custom_description_tab’, 98 );
function woo_custom_description_tab( $tabs ) {

$tabs[‘description’][‘callback’] = ‘woo_custom_description_tab_content’; // Custom description callback

return $tabs;
}
function woo_custom_description_tab_content() {
echo ‘<h2>Custom Description</h2>’;
echo ‘<p>Here\’s a custom description</p>’;
}

/*
* Add a custom tab
* Use the following snippet to add a custom global product tab
*/

add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs[‘test_tab’] = array(
‘title’ => __( ‘New Product Tab’, ‘woocommerce’ ),
‘priority’ => 50,
‘callback’ => ‘woo_new_product_tab_content’
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo ‘<h2>New Product Tab</h2>’;
echo ‘<p>Here\’s your new product tab.</p>’;

}