<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Ahmad</title>
    <description>The latest articles on DEV Community by Muhammad Ahmad (@ahmadthedev).</description>
    <link>https://dev.to/ahmadthedev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F298356%2F653a3e48-764d-4c6a-a0e8-c21de439a09a.jpg</url>
      <title>DEV Community: Muhammad Ahmad</title>
      <link>https://dev.to/ahmadthedev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmadthedev"/>
    <language>en</language>
    <item>
      <title>Drag and Drop Rows in WordPress Using jQuery UI</title>
      <dc:creator>Muhammad Ahmad</dc:creator>
      <pubDate>Sat, 25 Nov 2023 12:34:52 +0000</pubDate>
      <link>https://dev.to/ahmadthedev/drag-and-drop-rows-in-wordpress-using-jquery-ui-42f0</link>
      <guid>https://dev.to/ahmadthedev/drag-and-drop-rows-in-wordpress-using-jquery-ui-42f0</guid>
      <description>&lt;p&gt;Introduction:&lt;/p&gt;

&lt;p&gt;As WordPress developers, we often find ourselves in situations where we need to create custom plugins to cater to the unique requirements of our clients. Recently, I encountered a challenge while developing a WordPress plugin for a client who required a user-friendly way to manage data through sortable rows with drag-and-drop functionality. Surprisingly, the resources available on this topic were limited, and I faced difficulties finding a comprehensive guide.&lt;/p&gt;

&lt;p&gt;In an effort to bridge this gap and assist fellow developers facing similar challenges, I’ve decided to share my insights and the solution I crafted for implementing sortable rows with drag-and-drop in WordPress. This article serves as a guide for those seeking a clear and detailed explanation of the process. So, whether you’re developing a custom plugin or simply interested in enhancing your WordPress skills, this article is tailored for you. Let’s dive into the world of sortable tables and make the data management experience smoother for both developers and end-users.&lt;/p&gt;

&lt;p&gt;Checkout the complete guide for creating &lt;a href="https://www.ahmadthedev.com/wordpress/drag-and-drop-rows-in-wordpress-using-jquery/"&gt;sortable rows in WordPress&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>wordpress</category>
      <category>jquery</category>
    </item>
    <item>
      <title>How to Make Images Retina-Ready for your WordPress Theme without any plugin?</title>
      <dc:creator>Muhammad Ahmad</dc:creator>
      <pubDate>Tue, 17 Jan 2023 18:50:58 +0000</pubDate>
      <link>https://dev.to/ahmadthedev/how-to-make-images-retina-ready-for-your-wordpress-theme-without-any-plugin-po</link>
      <guid>https://dev.to/ahmadthedev/how-to-make-images-retina-ready-for-your-wordpress-theme-without-any-plugin-po</guid>
      <description>&lt;h1&gt;
  
  
  Step 1: Define Image Sizes
&lt;/h1&gt;

&lt;p&gt;`add_action( 'after_setup_theme', function(){&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$image_sizes = [
    [
        'size'      =&amp;gt;  'thumbnail',
        'width'     =&amp;gt;  150,
        'height'    =&amp;gt;  150
    ],
    [
        'size'      =&amp;gt;  'medium',
        'width'     =&amp;gt;  300,
        'height'    =&amp;gt;  300
    ],
    [
        'size'      =&amp;gt;  'medium_large',
        'width'     =&amp;gt;  768,
        'height'    =&amp;gt;  0
    ],
    [
        'size'      =&amp;gt;  'large',
        'width'     =&amp;gt;  1024,
        'height'    =&amp;gt;  1024
    ]
];

foreach( $image_sizes as $sizes ) {
    add_image_size( sprintf('%s', $sizes['size']), $sizes['width'], $sizes['height'] );
    add_image_size( sprintf('%s@%dx', $sizes['size'], 2), $sizes['width']*2, $sizes['height']*2 );
    add_image_size( sprintf('%s@%dx', $sizes['size'], 3), $sizes['width']*3, $sizes['height']*3 );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;} );`&lt;/p&gt;
&lt;h1&gt;
  
  
  Step 2: Insert Retina Sizes in &lt;code&gt;SRCSET&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;`add_filter( 'wp_get_attachment_image_attributes', function( $attr, $attachment, $size ) {&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$img_id         = $attachment-&amp;gt;ID;
$requested_image    = wp_get_attachment_image_src( $img_id, $size );
$res            = ['2x', '3x'];
$srcset         = [];
$size_args          = [
    'width'     =&amp;gt; $requested_image[1],
    'height'    =&amp;gt; $requested_image[2]
];

$srcset[] = $requested_image[0] .' 1x';
foreach($res as $r) {
    $r_img = $size .'@'. $r;
    $r_src = wp_get_attachment_image_src($img_id, $r_img);
    if($r_src[3] == true) {
        $srcset[] = esc_url($r_src[0]) .' '. $r;
    }
}

$attr['src']    = $requested_image[0];
$attr['srcset'] = implode( ', ', $srcset );
unset($attr['sizes']);

return $attr;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}, 10, 3 );`&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://www.ahmadthedev.com/wordpress/retina-ready-images-without-plugin/" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--S8K0bBsK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.ahmadthedev.com/wp-content/uploads/2023/11/Muhammad-Ahmad.jpg" height="1113" class="m-0" width="800"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://www.ahmadthedev.com/wordpress/retina-ready-images-without-plugin/" rel="noopener noreferrer" class="c-link"&gt;
          How to Make Images Retina-Ready for your WordPress Theme without any plugin?
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Let's first understand why its important for your website to retina-ready nowadays. With the rise of very high density "super retina" displays in the newest
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--t6JIQzDa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.ahmadthedev.com/wp-content/uploads/2023/11/cropped-favicon-512x512-1-32x32.png" width="32" height="32"&gt;
        ahmadthedev.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Have fun coding!&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>performance</category>
    </item>
    <item>
      <title>How to Add Numbered Pagination in WordPress without using any plugin?</title>
      <dc:creator>Muhammad Ahmad</dc:creator>
      <pubDate>Wed, 08 Apr 2020 19:41:30 +0000</pubDate>
      <link>https://dev.to/ahmadthedev/how-to-add-numbered-pagination-in-wordpress-without-using-any-plugin-4iii</link>
      <guid>https://dev.to/ahmadthedev/how-to-add-numbered-pagination-in-wordpress-without-using-any-plugin-4iii</guid>
      <description>&lt;p&gt;Pagination plays a very important part in websites creation. Basically, it allows users to page back and forth through multiple pages of content. It also helps you to control the length of the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Lets discuss some basics but important questions
&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Paginate_links()
&lt;/h3&gt;

&lt;p&gt;Function &lt;code&gt;paginate_links()&lt;/code&gt; is the WordPress’s builtin function and can be used to create a paginated link list for any area.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Why do you need an unlikely integer in pagination?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;get_pagenum_link( $big )&lt;/code&gt; will create an URL, not a link based on the number provided in the first parameter. This function is used to get the basic pattern for the URL, and the high integer is used here because we must provide an integer as an argument.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. What is the difference between &lt;code&gt;get_query_var('paged')&lt;/code&gt; and &lt;code&gt;get_query_var('page')&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;The function &lt;code&gt;get_query_var()&lt;/code&gt; is used to get the values from &lt;code&gt;$wp_query&lt;/code&gt; public query variables, and in this case that is &lt;code&gt;page&lt;/code&gt; and &lt;code&gt;paged&lt;/code&gt;. These two parameters and their values are used by &lt;code&gt;WP_Query&lt;/code&gt; to calculate pagination and more importantly the offset of posts according to page numbers.&lt;br&gt;
&lt;strong&gt;paged&lt;/strong&gt; used on the home, blog, archive pages, and pages to calculate pagination. 1st page is &lt;code&gt;0&lt;/code&gt; and from there the number corresponding to the page number.&lt;br&gt;
&lt;strong&gt;page&lt;/strong&gt; use on a static front page and single pages for pagination. By pagination on single pages, I mean that single posts can be broken down into multiple pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Why we use wp_reset_postdata()?
&lt;/h3&gt;

&lt;p&gt;You need to use &lt;code&gt;wp_reset_postdata()&lt;/code&gt; after every custom &lt;code&gt;WP_Query()&lt;/code&gt; to resets the value of the &lt;code&gt;global $post&lt;/code&gt; variable to the post property of the main query.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>pagination</category>
      <category>numberpagination</category>
      <category>numericpagination</category>
    </item>
    <item>
      <title>How to create a custom WordPress breadcrumb without a plugin?</title>
      <dc:creator>Muhammad Ahmad</dc:creator>
      <pubDate>Mon, 06 Apr 2020 14:20:19 +0000</pubDate>
      <link>https://dev.to/ahmadthedev/how-to-create-a-custom-wordpress-breadcrumb-without-a-plugin-23p0</link>
      <guid>https://dev.to/ahmadthedev/how-to-create-a-custom-wordpress-breadcrumb-without-a-plugin-23p0</guid>
      <description>&lt;p&gt;Breadcrumbs are navigation links, used to display all the pages leading from the home page. This is placed at the top of the page and helps to backward navigation. You guys may think what is the purpose of this post as there are tones of plugins that are doing the same job. Well, the answer is simple the more plugins or external resources you use, the more heavy and hard to maintain your website.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ahmadthedev"&gt;
        ahmadthedev
      &lt;/a&gt; / &lt;a href="https://github.com/ahmadthedev/wp-breadcrumb-function"&gt;
        wp-breadcrumb-function
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>wordpress</category>
      <category>breadcrumbs</category>
      <category>navigation</category>
    </item>
  </channel>
</rss>
