Skip to content

Instantly share code, notes, and snippets.

View Asikur22's full-sized avatar
💜
Web Developer | In Love with WordPress

Asiqur Rahman Asikur22

💜
Web Developer | In Love with WordPress
View GitHub Profile
@Asikur22
Asikur22 / functions.php
Last active December 31, 2019 12:45
[Only Show Current User’s Media/Attachments] #Media
/*
* Only Show Current User's Media Attachments
*/
function show_current_user_attachments( $query ) {
$user_id = get_current_user_id();
if ( $user_id ) {
$query[ 'author' ] = $user_id;
}
@Asikur22
Asikur22 / functions.php
Created April 10, 2019 17:43
[Add Extra CSS Class to Widget]
/*
* Add Extra CSS Class to Widget
*/
function add_extra_class_to_widget( $params ) {
// get widget vars
$widget_name = $params[ 0 ][ 'widget_name' ];
$widget_id = $params[ 0 ][ 'widget_id' ];
// bail early if this widget is not a Text widget
@Asikur22
Asikur22 / functions.php
Created April 10, 2019 17:45
[Remove Text “Category:”, “Tag:”, “Author:”, “Archives:” and Other Taxonomy Name From Archive Title] #WordPress
/*
* Remove Text "Category:", "Tag:", "Author:", "Archives:" and "Other Taxonomy Name:" From Archive Title
*/
function das_archive_title_modification( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '' . get_the_author() . '';
@Asikur22
Asikur22 / VirtualBox.md
Last active April 10, 2019 17:54
[How To Increase VirtualBox’s Disk Space]
  • Open a Command Prompt Window (Run as Administrator)
  • Change to VirtualBox’s Program Files Folder
  • Then type the code below in the Command Prompt.
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MBCOPY

Replacing YOUR_HARD_DISK and SIZE_IN_MB with your Hard Disk name and desired size.

Example:

@Asikur22
Asikur22 / functions.php
Last active October 27, 2022 10:19
Get Custom Field/Metabox Data on Blog Page #cmb #meta
// get the page id.
$page_id = ( 'page' == get_option( 'show_on_front' ) ? get_option( 'page_for_posts' ) : get_the_ID );
// echo page meta for $page_id
echo get_post_meta( $page_id, 'page_title_two', true );
@Asikur22
Asikur22 / sublime-text
Last active January 5, 2025 08:00
[Disable “Update Available” pop up on Sublime Text]
Just go to Preferences -> Settings-User and add there:
"update_check": false,
For sulime text 2 and below
@Asikur22
Asikur22 / plugin.php
Last active November 17, 2019 17:32
[WP Plugin Header]
/*
* Plugin Name: Green Life
* Plugin URI: https://greenlifeit.com/plugins
* Description: Plugin Description.
* Author: Asiqur Rahman
* Author URI: https://asique.net
* Version: 1.0.0
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: text-domain
@Asikur22
Asikur22 / functions.php
Created April 13, 2019 11:39
Add Internal CSS Style in Wordpress
function add_internal_css_style() {
?>
<style type="text/css">
.classname {
margin: 0;
}
</style>
<?php
}
add_action( 'wp_head', 'add_internal_css_style' );
@Asikur22
Asikur22 / dashboard.md
Last active August 17, 2019 17:17
[Dashboard Menu Item Positioning/Ordering]

What the values mean:

  • 0 - at the very top
  • 5 - below Posts
  • 10 - below Media
  • 15 - below Links
  • 20 - below Pages
  • 25 - below comments
  • 60 - below first separator
  • 65 - below Plugins
  • 70 - below Users
@Asikur22
Asikur22 / functions.php
Created April 13, 2019 13:02
Register WP Menu
function wordpress_register_menu() {
if (function_exists('register_nav_menu')) {
register_nav_menu( 'primary', 'Main Menu' );
}
}
add_action('init', 'wordpress_register_menu');