top of page

Exposing ACF Fields to WP REST API

Exposing ACF Fields to REST API is pretty Simple with help of hooks add_filter('rest_prepare_{post_type_key}', 'acf_to_rest_api', 10, 3);...

Expose Custom Fields in REST API

Code for Custom Post Type function custom_product_type() { $labels = array( 'name' => _x( 'Product', 'Post Type...

Change Admin Icons and Admin Logo

function horton_login_logo() { ?> <style type="text/css"> #login h1 a, .login h1 a { background-image: url(<?php echo...

Using SCP to Transfer Files

sudo scp -r -i laurenmuseHQ /var/www/html/wp-content/uploads bootcamp1@bootcamp1.ssh.wpengine.net:/home/wpe-user/sites/bootcamp1/wp-cont...

Add Subject and Body to mailto

<li data-aos="fade-in" data-aos-delay="80"> <a href="mailto:info@ma.orilg?subject=<?php echo get_the_title() ; ?>&body=<?php echo...

Equalize Div with Jquery

var maxHeight = 0; jQuery(".wprevpro_t1_DIV_2").each(function(){ if (jQuery(this).height() > maxHeight) { maxHeight =...

Page Specific CSS and JS in wordpress

function hollycross_scripts() { wp_enqueue_style( 'clndrcss', get_template_directory_uri() . '/css/clndr.css', array(), _S_VERSION ); ...

Get Row and Get Result from Global $wpdb

public static function get_juridiction_city_from_user_zip($zipcode){ global $wpdb; $sql = "SELECT * FROM ".$wpdb->prefix."dk_speakou...

Get User IP Address in PHP

public static function function get_client_ip() { $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress =...

Add browser Specific Class to HTML

function blankslate_footer_scripts() { ?> <script> jQuery(document).ready(function ($) { var deviceAgent = navigator.userAgent.toLowerCas...

Social Share Image on Twitter/Facebook/Linkedin

<!DOCTYPE html> <html> <head> <title></title> <meta property="og:locale" content="en_US" /> <meta property="og:type" content="article"...

Forget Password in WordPress

AJAX call in JavaScript jQuery('#forgetpassbutton').click(function(e){ e.preventDefault(); jQuery.ajax({ type: 'POST', url :...

Creating a Login Logout Programatically

add_filter( 'wp_nav_menu_items', 'kd_conditional_nav_items', 10, 2 ); function kd_conditional_nav_items( $menu, $args ) { if (...

REST API (POST/GET/PUT/DELETE) in php

Create a POST Request $postdata = array('name'=>'Hosting Transfer','price'=> '250'); $data_json = json_encode($postdata); $headers =...

Changing Directory Permission with Code

<?php file_fix_directory(dirname(__FILE__)); function file_fix_directory($dir, $nomask = array('.', '..')) { if (is_dir($dir)) { // Try...

Zip and Unzip in PHP

Code to Zip <?php //echo getcwd(); die; $rootPath = realpath('/home/cififacywac8/public_html'); // Initialize archive object $zip = new...

Useful SQL Queries in Wordpress

1- Delete unapproved comment DELETE from wp_comments WHERE comment_approved IN ('0','trash','spam','post-trashed') 2- Delete all...

Create a CSV Export in Wordress

This code creates a sample plugin that can export users from word press based on roles So logically the hook is as below add_action(...

© 2020 by syednazrulhassan

bottom of page