Skip to content

Instantly share code, notes, and snippets.

# First switch to database
USE db_name;
# replace file name with full file path.
SET autocommit=0; source the_sql_file.sql; COMMIT ;
@majeedraza1
majeedraza1 / remove-yoast-seo-metabox-from-a-custom-post-type.php
Created December 19, 2022 02:47
Remove Yoast SEO metabox from a custom post type.
function remove_yoast_meta_boxes( $post_type ) {
$custom_post_type= 'movies'; // Replace this with your actual post type name.
if ( $custom_post_type === $post_type ) {
// remove Yoast SEO metaboxes if present.
remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
remove_meta_box( 'yoast_internal_linking', $post_type, 'side' );
}
}
add_action( 'add_meta_boxes', 'remove_yoast_meta_boxes', 90 );
// Remember to give priority a higher number. e.g. 90 or more bigger
# update the Apt cache and upgrade the current packages of system
sudo apt update && sudo apt upgrade
# nstall few dependencies required
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https
# Add the Ondrej PPA
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
@majeedraza1
majeedraza1 / php-config-for-wordpress.ini
Created May 16, 2022 10:56
PHP configuration for a WordPress site.
; the maximum time in seconds a script is allowed to run before it is terminated by the parser
max_execution_time = 300
; the maximum amount of memory in bytes that a script is allowed to allocate.
; Suggested: 256 MB or greater
memory_limit = 128M
; How many input variables may be accepted
max_input_vars = 4000
@majeedraza1
majeedraza1 / wordpress.test
Last active February 15, 2020 13:38
Nginx vHost configuration sample for WordPress project
server {
# Point your wordpress project directory. in our case it is (/var/www/wordpress.test)
root /var/www/wordpress.test;
index index.php;
# Give virtual host domain name
server_name wordpress.test www.wordpress.test;
location = /favicon.ico {
<?php
use Elementor\Plugin;
use Elementor\Widget_Base;
class Shapla_Hero_Slider extends Widget_Base {
/**
* Retrieve the name.
*
<?php
if ( ! class_exists('Validate') ) {
class Validate {
/**
* Check if the value is present.
*
* @param mixed $value
* @return boolean
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Add custom fee to cart automatically
*
*/
function woo_add_cart_fee() {
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
<?php
// Place this in your functions.php file in your theme folder.
remove_theme_support( 'wc-product-gallery-lightbox' );