WordPress plugin- Share Post On WhatsApp


Description
Share posts/page/custom post to whatsApp.

Feature
Setting to Enable/Disable WhatsApp Share Icon


Installation
  1. Upload the folder “share-post-on-whatsapp” to “/wp-content/plugins/”
  2. Activate the plugin through the “Plugins” menu in WordPress
  3. Manage setting to ‘Enable/Disable WhatsApp Share Icon’ by going WP-admin -> Settings ->Share Post on WhatsApp
  4. Enjoy! as there is setting to Enable/Disable WhatsApp Share Icon in admin.
Output

  Download plugin

Wordpress- WordPress Post Pagination without plugin

STEP 1. Add the following function to your functions.php file:
 
 
function pagination($pages = '', $range = 2)
{  
     $showitems = ($range * 2)+1;  

     global $paged;
     if(empty($paged)) $paged = 1;

     if($pages == '')
     {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
         if(!$pages)
         {
             $pages = 1;
         }
     }   

     if(1 != $pages)
     {
         echo "\n";
     }
}

STEP 2. To style it, add the following to your stylesheet (typically style.css).
.pagination {
 clear:both;
 padding:20px 0;
 position:relative;
 font-size:11px;
 line-height:13px;
}
.pagination span, .pagination a {
 display:block;
 float:left;
 margin: 2px 2px 2px 0;
 padding:6px 9px 5px 9px;
 text-decoration:none;
 width:auto;
 color:#fff;
 background: #555;
}
.pagination a:hover{
 color:#fff;
 background: #3279BB;
}
.pagination .current{
 padding:6px 9px 5px 9px;
 background: #3279BB;
 color:#fff;
}
STEP 3: Final step, Put in your template file:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$arg= array('post_type' => 'post-type',
   'taxonomy' => 'texonomy-slug',
   'term'=> 'term-slug',
   'paged' => $paged,
   'posts_per_page' => 5,
   'orderby' => 'date',
   'post_status'=>'publish'                                                                       
     );
$loop = new WP_Query($arg);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
 
<?php endwhile; ?>

<?php if (function_exists("pagination")) {
    pagination($loop->max_num_pages);
} 

Wordpress plugin - Category and Taxonomy Image


Features :
  • Setting for taxonomy,image field to be enabled.
  • Very simple in use
  • Can be customized easily.
Installation:
  1. Unzip into your /wp-content/plugins/ directory. If you're uploading it make sure to upload the top-level folder. Don't just upload all the php files and put them in /wp-content/plugins/.
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to your WP-admin ->Settings menu a new "Taxonomy Image" page is created.
  4. Go to your WP-admin ->Settings ->Taxonomy Image displayed in the taxonomies list form where you can select the taxonomies you want to include it in WP Custom Taxonomy Image.
  5. Go to your WP-admin select any category/term ,here image text box where you can manage image for that category/term.
  6. you can use the following function into your templates to get category/term image:
 
if (function_exists('get_wp_term_image'))
{
   $meta_image = get_wp_term_image($term_id); 
   //It will give category/term image url 
}

echo $meta_image; // category/term image url
where $term_id is 'category/term id'


Screenshots :





WP Custom Taxonomy Image Plugin allow you to add image with category/taxonomy..

Wordpress plugin - Client Logo Carousel

Display client logos responsive carousel with the help of a shortcode in editor as well as template page. Having different carousel settings.

Features :
  • Simple and light weight
  • Fully responsive
  • Having different settings in admin
  • Ability to add client links to each logo
  • Auto slide option
Installation:
  1. Upload the folder "wp-client-logo-carousel" to "/wp-content/plugins/" '
  2. Activate the plugin through the "Plugins" menu in WordPress .
  3. Update settings for carousel going to wp-admin->WP Client Logo->Logo Carousel Settings
  4. Add client logo going to wp-admin->WP Client Logo->Add New Client Logo..
  5. Call shortcode to your wordpress editor directly, by using
[wpaft_logo_slider]
Call shortcode to your php template file using
 
echo do_shortcode('[wpaft_logo_slider]');
Carousel By category *
To show logos from a particular category. We can call shortcode to our wordpress editor directly, by using
 
[wpaft_logo_slider category="SLUG OF CAROUSEL CATEGORY"]
* And we can call shortcode to our php template file using
  
echo do_shortcode('[wpaft_logo_slider category="CAROUSEL CATEGORY SLUG"]');
NOTE: Be sure the 'SLUG OF CAROUSEL CATEGORY' is the slug of category.

Screenshots :






Download plugin:

Magento 1.9 - getBaseUrl retrieving different urls

Magento getBaseUrl retrieving different urls

There are multiple ways. For examples:-

1. http://yourdomain.com/

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); 

2. http://yourdomain.com/index.php/

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); 

3.http://yourdomain.com/js/

 
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); 

4.http://yourdomain.com/media/

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); 

5.http://yourdomain.com/skin/

 
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); 

Magento - How to show all products of a category in only one page

Question: How can we show all products of a category in only one page?
Answer: You can find the solution in Magento backend,

it's like this :
Configuration > catalog > frontend > Allow All Products per Page > yes 

Woocommerce- Change number or products per row to 3

Question: How can we change number or products per row to 3 in woocommerce?
Answer:  We can this adding below filter in functions.php

// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
        return 3; // 3 products per row
    }
} 

SSH- How to zip a folder via SSH Terminal

This is how you can zip a folder via SSH on your Linux server. Works on Debian and other servers.

zip -r filename.zip foldername/

jQuery- Stop YouTube video within iFrame on external Button click

 
//First get the  iframe URL
var url = jQuery('#YourIFrameID').attr('src');

//Then assign the src to null, this then stops the video been playing
jQuery('#YourIFrameID').attr('src', '');

// Finally you reasign the URL back to your iframe, so when you hide and load it again you still have the link
jQuery('#YourIFrameID').attr('src', url);

jQuery- show div on hover - hide div on mouseout

Question: How can we show div on hover and hide div on mouseout ?

Answer: Using below example code we can do this.

HTML
hover anchor

lorem ipsum dolor sit amet......

JS
(function(){
  var del = 200;
  $('.icontent').hide().prev('a').hover(function(){
    $(this).next('.icontent').stop('fx', true).slideToggle(del);
  });
})();

Magento 1.9 - Add to cart button on upsell product page in magento

To add "add to cart" button on upsell product page-

Follow below steps : -

STEP 1. open the upsell.phtml page:-

i.e.
app/design/frontend/default/your theme/template/catalog/product/list/upsell.phtml

STEP 2. Put the code where button to show-


Enjoy:)

jQuery- Toggle Up and Dowm

HTML:
 

Click 1

Click 2

SCRIPT:
 
jQuery(document).ready(function() {
    jQuery('#faq-list h2').click(function() {
       jQuery(this).next('.answer').slideToggle(500);
       jQuery(this).toggleClass('close');
       
    });
}); // end ready
Important: Please make sure, jQuery library is included in the page.

PHP- How can we convert string to slug?

Below is the function to convert string to slug.
 
function createSlug($str, $delimiter = '-'){

$slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter));
  
 return $slug;

}
For example:
 
$str= 'this is slug'; //If this is the string which we have to convert as slug
$createdSlug= createSlug($str); //Call funtion
echo $createdSlug; // Print output
Output:
 
this-is-slug

Wordpress- How to disable responsive images srcset in WP 4.4+

We have to just paste below code in theme's function.php
 
//disable src set
function aft_disable_srcset( $sources ) {
    return false;
}
add_filter( 'wp_calculate_image_srcset', 'aft_disable_srcset' );

Wordpress- How can we customize custom logo dimension in child theme?

Question: How can we customize custom logo dimension in child theme?

Answer: Putting following code/hook in child theme functions.php, logo dimension could be customized.

If we want to add width=500 and height=200 for logo, we can use below filter.

add_action( 'after_setup_theme', 'child_theme_logo_customize', 99 );
function child_theme_logo_customize() {
    add_theme_support( 'custom-logo', array(
        'width'  => 500,
        'height' => 200,
    ) );
} 

CSS- Creating full width (100% ) container inside fixed width container.


Question: How can we create full   width (100% ) container inside fixed width container with CSS?
 
Answer: Some times we need to add a full width containers (which spans 100% of window) inside a container which has a fixed width and aligned center.

Like below screenshot-

HTML
 

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

--- Full width container ---

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

CSS
 
.row-full{
 width: 100vw;
 position: relative;
 margin-left: -50vw;
 height: 100px;
 left: 50%;
 background-color:red;
}

SSH- List of Basic SSH Commands

SSH CommandExplanation
lsShow directory contents (list the names of files).
cdChange Directory.
mkdirCreate a new folder (directory).
touchCreate a new file.
rmRemove a file.
catShow contents of a file.
pwdShow current directory (full path to where you are right now).
cpCopy file/folder.
mvMove file/folder.
grepSearch for a specific phrase in file/lines.
findSearch files and directories.
vi/nanoText editors.
historyShow last 50 used commands.
clearClear the terminal screen.
tarCreate & Unpack compressed archives.
wgetDownload files from the internet.
duGet file size.

CSS- Responsive Masonry Layout using Only CSS without jQuery

Question: How can we do responsive Masonry Layout using Only CSS without jQuery?
Answer: Below are the code and output responsive Masonry Layout using Only CSS without jQuery.
HTNL
Lorem ipsum dolor sit amet, consectetur.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error aliquid reprehenderit expedita odio beatae est.
Lorem ipsum dolor sit amet, consectetur.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nobis quaerat suscipit ad.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem nihil alias amet dolores fuga totam sequi a cupiditate ipsa voluptas id facilis nobis.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem ut debitis dolorum earum expedita eveniet voluptatem quibusdam facere eos numquam commodi ad iusto laboriosam rerum aliquam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat architecto quis tenetur fugiat veniam iste molestiae fuga labore!
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit accusamus tempore at porro officia rerum est impedit ea ipsa tenetur. Labore libero hic error sunt laborum expedita.
Lorem ipsum dolor sit.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima asperiores eveniet vero velit eligendi aliquid in.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus dolorem maxime minima animi cum.
CSS
*, *:before, *:after {box-sizing:  border-box !important;}
article {-moz-column-width: 13em; -webkit-column-width: 13em;-moz-column-gap: 1em; -webkit-column-gap: 1em; }
section {display: inline-block;margin:  0.25rem;padding:  1rem;width:  100%; background:  #efefef;}

OUTPUT

SSH- Change all files and folders permissions of a directory to 644/755

SSH- Change all files and folders permissions of a directory to 644/755
 
find * -type d -print0 | xargs -0 chmod 0755 # for directories
find . -type f -print0 | xargs -0 chmod 0644 # for files
For WordPress -
All files should be 664.
All folders should be 775.
wp-config.php should be 660.

Magento 1.9 - How can we make a slider of product thumbnail images on product page ?

Question: How can we make a slider of product thumbnail images on product page in Magento 1.9.?


Answer: For this, we can follow below-
 Go to app/design/frontend   you_theme  catalog/product/view/media.phtml
And can use below codes:

<?php echo $this->getChildHtml('after'); ?>

<?php if (count($this->getGalleryImages()) > 0): ?>
<div class="more-views">
  
    <ul id="prod-thumb" class="product-image-thumbs owl-carousel owl-theme">
    <?php $i=0; foreach ($this->getGalleryImages() as $_image): ?>
        <?php
        if (($filterClass = $this->getGalleryFilterHelper()) && ($filterMethod = $this->getGalleryFilterMethod()) && !Mage::helper($filterClass)->$filterMethod($_product, $_image)):
            continue;
        endif;
        ?>
        <li class="item">
            <a class="thumb-link" href="#" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>" data-image-index="<?php echo $i; ?>">
                <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(75); ?>"
                     width="75" height="75" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" />
            </a>
        </li>
    <?php $i++; endforeach; ?>
    </ul>
</div>
<?php endif; ?>

<?php echo $this->getChildHtml('after'); ?>


<script type="text/javascript" src="<?php echo  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>js/owlcarousel/owl.carousel.js"></script>

<script>
jQuery(document).ready(function() {

  jQuery("#prod-thumb").owlCarousel({
    items : 3,
    itemsCustom : [
      
        [320, 3],
        [480, 4],
        [600, 5],
        [760, 4],
        [900, 4],
      ],   
    lazyLoad : true,
    navigation : true,
    pagination: false
  });

});
</script>

 <style>


/* clearfix */
.owl-carousel .owl-wrapper:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}
/* display none until init */
.owl-carousel{
    display: none;
    position: relative;
    width: 100%;
    -ms-touch-action: pan-y;
}
.owl-carousel .owl-wrapper{
    display: none;
    position: relative;
    -webkit-transform: translate3d(0px, 0px, 0px);
}
.owl-carousel .owl-wrapper-outer{
    overflow: hidden;
    position: relative;
    width: 50%;
}
.owl-carousel .owl-wrapper-outer.autoHeight{
    -webkit-transition: height 500ms ease-in-out;
    -moz-transition: height 500ms ease-in-out;
    -ms-transition: height 500ms ease-in-out;
    -o-transition: height 500ms ease-in-out;
    transition: height 500ms ease-in-out;
}
   
.owl-carousel .owl-item{
    float: left;
}
.owl-controls .owl-page,
.owl-controls .owl-buttons div{
    cursor: pointer;
}
.owl-controls {
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* mouse grab icon */
.grabbing {
    cursor:url(grabbing.png) 8 8, move;
}

/* fix */
.owl-carousel  .owl-wrapper,
.owl-carousel  .owl-item{
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility:    hidden;
    -ms-backface-visibility:     hidden;
  -webkit-transform: translate3d(0,0,0);
  -moz-transform: translate3d(0,0,0);
  -ms-transform: translate3d(0,0,0);
}

  </style>

Wordpress- I want to add pagination with list of categories

Question: How can we integrate pagination with list of categories in wordPress?

Answer: Below are code to integrate pagination with list of categories in wordPress.

 
$args = array(
	'parent' => 0,
	'hide_empty' => 0
);

$categories = get_categories( $args );
$cat =  ceil(count( $categories )/5);    
$j=0;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$posts_per_page = 5;
$offset = ($posts_per_page * $paged) - 5 ;
$args = array(
	'orderby' => 'name',
	'parent' => 0,
	'hide_empty'         => 0,
	'number' => $posts_per_page,
	'offset' => $offset,
	'posts_per_page' => 5,
	'paged' => $paged
	//'exclude'            => '1,3,24,9'
);
$categories = get_categories( $args );
foreach ( $categories as $category ) {
 $j++;
 echo '' . $category->name . '
'; } $big = 999999999; // need an unlikely integer echo '';

Magento 1.9 - Cannot display image inserted by WYSIWYG editor

I finally solved the problem. The cause of the problem is unprocessed shortcodes in the html content, which is the {{ media url="..." }} statement. Before echo this statement, the html content should be process by the processor from helper "cms". Below is the code:

$html_content = $content_from_db['content'];
$html_content = Mage::helper('cms')->getPageTemplateProcessor()->filter($html_content);
echo $html_content;

CSS- Star Rating Input using CSS and HTML

Example:

HTML:
Rating:
  
 
 
 
 
 
 
 
 
 
 
  



CSS:
.starRating:not(old){
  display        : inline-block;
  width          : 7.5em;
  height         : 1.5em;
  overflow       : hidden;
  vertical-align : bottom;
}

.starRating:not(old) > input{
  margin-right : -100%;
  opacity      : 0;
}

.starRating:not(old) > label{
  display         : block;
  float           : right;
  position        : relative;
  background      : url('star-off.png');
  background-size : contain;
}

.starRating:not(old) > label:before{
  content         : '';
  display         : block;
  width           : 1.5em;
  height          : 1.5em;
  background      : url('star-on.png');
  background-size : contain;
  opacity         : 0;
  transition      : opacity 0.2s linear;
}

.starRating:not(old) > label:hover:before,
.starRating:not(old) > label:hover ~ label:before,
.starRating:not(:hover) > :checked ~ label:before{
  opacity : 1;
}
Note: Make sure that two images 'star-off.png' and 'star-on.png'  are existing, which you are using in CSS .

jQuery- How can we do multiple drop-down values auto suggestions?

Question: How can we do multiple drop-down values Auto suggestions?
Answer: We can do this using below codes using choosen libraries. We can test the code putting in a single html file test.html
Code 1: Include jQuery/CSS libraries





Code 2: jQuery script
$(function() {
    $(".choosen-select").chosen();
});
Code 3: HTML

Output

jQuery/HTML- Count characters in textarea

Topic: 1.Character Counting Remaining on textarea using jQuery.

Topic: 2. jQuery- Count characters in textarea

Topic: 3. How can I count characters in textarea on onkeyup() event using jQuery?

Solution:

We can find above topics solutions in below code.

STEP 1: Include jQuery

 

STEP 2: Script

 
function countChar(val) {
        var len = val.value.length;
        if (len >= 500) {
          val.value = val.value.substring(0, 500);
        } else {
          $('#charNum').text(500 - len);
        }
};

STEP 3: HTML

 
 
Remaining limit:500 characters

SSH- Useful SSH commands

SSH- Useful SSH commands

1. Access monitor

 mysql -u [username] -p; (will prompt for password)

2. Show all databases:

 show databases;

3. Access database:

 mysql -u [username] -p [database] (will prompt for password)

4.Create new database:

 create database [database];

5.Select database:

 use [database];

6. Determine what database is in use:

 select database();

7. Show all tables:

 show tables;

8. Show table structure:

 describe [table];

9. List all indexes on a table:

 show index from [table];

10. Create new table with columns:

 CREATE TABLE [table] ([column] VARCHAR(120), [another-column] DATETIME);

11. Adding a column:

 ALTER TABLE [table] ADD COLUMN [column] VARCHAR(120);

12. Adding a column with an unique, auto-incrementing ID:

 ALTER TABLE [table] ADD COLUMN [column] int NOT NULL AUTO_INCREMENT PRIMARY KEY;

13. Inserting a record:

 INSERT INTO [table] ([column], [column]) VALUES ('[value]', [value]');

14. MySQL function for datetime input:

 NOW()

15. Selecting records:

 SELECT * FROM [table];

16.Explain records:

 EXPLAIN SELECT * FROM [table];

17. Selecting parts of records:

 SELECT [column], [another-column] FROM [table];

18. Counting records:

 SELECT COUNT([column]) FROM [table];

19.Counting and selecting grouped records:

 SELECT *, (SELECT COUNT([column]) FROM [table]) AS count FROM [table] GROUP BY [column];

20. Delete all records in a table:

 truncate table [table];

21. Removing table columns:

 ALTER TABLE [table] DROP COLUMN [column];

22. Deleting tables:

 DROP TABLE [table];

23.Deleting databases:

 DROP DATABASE [database];

24. Custom column output names:

 SELECT [column] AS [custom-column] FROM [table];

25. Export a database dump:

 mysqldump -u [username] -p [database] > db_backup.sql

26. Import a database dump (more info here):

 mysql -u [username] -p -h localhost [database] < db_backup.sql

27. Logout:

 exit;

Opening YouTube Videos on a Custom Button Click Using jQuery

Welcome to See Coding!

At See Coding, we simplify web development through practical tutorials and examples. Today’s post shows how to create a YouTube video modal that opens on a button click using jQuery. Perfect for websites, portfolios, or e-commerce platforms!

Step-by-Step Guide to Implementing a YouTube Modal

1. HTML Structure

Here’s a basic structure for the button and modal. (Replace VIDEO_ID with your YouTube video’s unique ID.)


2. CSS for Modal Styling

This CSS ensures your modal is responsive and visually appealing.

.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}
.modal-content {
    width: 600px;
    max-width: 90%;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
}

3. jQuery for Button Click and Video Control

This script dynamically loads the video and handles modal events.

$(document).ready(function () {
    $(".open-video").on("click", function () {
        const videoUrl = $(this).data("video");
        $("#videoIframe").attr("src", videoUrl + "?autoplay=1");
        $("#videoModal").fadeIn();
    });

    $(".close, #videoModal").on("click", function () {
        $("#videoIframe").attr("src", "");
        $("#videoModal").fadeOut();
    });

    $(".modal-content").on("click", function (e) {
        e.stopPropagation();
    });
});


Engage With Us!

At See Coding, we love hearing from our readers.
💡 Have ideas for improvement?
📩 Need help customizing the code?
👉 Comment below or use our Conatct us.

WooCommerce – remove payment method from emails

Question: How can we remove payment method from emails in woocommerce?

Answer: We can use below woocommerce filter to remove payment method from emails in woocommerce.

add_filter( 'woocommerce_get_order_item_totals', 'custom_woocommerce_get_order_item_totals' );

function custom_woocommerce_get_order_item_totals( $totals ) {
  unset( $totals['payment_method'] );
  return $totals;
}