Skip to content

Instantly share code, notes, and snippets.

View jimi008's full-sized avatar
🏠
Working from home

Jamil Ahmed jimi008

🏠
Working from home
View GitHub Profile
@jimi008
jimi008 / functions.php
Created November 18, 2015 05:56 — forked from jameskoster/functions.php
WordPress - Move the textarea to the top of the comment form
function jk_move_textarea( $input = array () ) {
static $textarea = '';
if ( 'comment_form_defaults' === current_filter() ) {
$textarea = $input['comment_field'];
$input['comment_field'] = '';
return $input;
}
if ( is_singular( 'post' ) || is_page() ) {
print $textarea;
@jimi008
jimi008 / How to use Images as Radio buttons.md
Created June 28, 2016 15:01 — forked from rcotrina94/How to use Images as Radio buttons.md
How to use images for radio buttons (input-radio).
@jimi008
jimi008 / gfcptaddonbase.php
Created July 15, 2016 12:15 — forked from anonymous/gfcptaddonbase.php
Temp fix for Multiselect of Custom Taxonomies in Gravity Forms + Custom Post Types 3.1
<?php
if (!class_exists('GFCPTAddonBase')) {
/*
* Base class for the GFCPT Addon. All common code is in here and differences per version are overrided
*/
class GFCPTAddonBase {
protected $_has_tag_inputs = false;
@jimi008
jimi008 / compatibility.js
Created May 23, 2017 07:18 — forked from danielpataki/compatibility.js
jQuery in WordPress
/* Regular jQuery */
$('.hideable').on('click', function() {
$(this).hide();
})
/* Compatibility Mode */
jQuery('.hideable').on('click', function() {
jQuery(this).hide();
})
@jimi008
jimi008 / README.md
Created October 29, 2017 20:23 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@jimi008
jimi008 / custom-registration.php
Created November 9, 2017 07:17 — forked from trslater/custom-registration.php
Custom Registration Plugin
<?php
/*
Plugin Name: Custom Registration
Description: Updates user rating based on number of posts.
Version: 1.1
Author: Tristan Slater w/ Agbonghama Collins
Author URI: http://kanso.ca
*/
@jimi008
jimi008 / wp-get_id_by_slug
Created December 19, 2017 08:22 — forked from eddt/wp-get_id_by_slug
WordPress: Get page ID from slug
// Usage:
// get_id_by_slug('any-page-slug','any-post-type');
function get_id_by_slug($page_slug, $slug_page_type = 'page') {
$find_page = get_page_by_path($page_slug, OBJECT, $slug_page_type);
if ($find_page) {
return $find_page->ID;
} else {
return null;
}
<?php
/*=========================================
Custom Submit Box
==========================================*/
/**
* Loop throught custom post types and
* replace default submit box
*
* @since 1.0
*
@jimi008
jimi008 / sync_acf_post_title.php
Created March 31, 2018 01:51 — forked from rveitch/sync_acf_post_title.php
Update WordPress post title from an ACF field value on save. (Advanced Custom Fields)
<?php
/**
* Update Post Title from an ACF field value on post save.
*
* Triggers on save, edit or update of published posts.
* Works in "Quick Edit", but not bulk edit.
*/
function sync_acf_post_title($post_id, $post, $update) {
$acf_title = get_field('my_acf_field_name', $post_id); // NOTE: enter the name of the ACF field here
@jimi008
jimi008 / functions.php
Created March 31, 2018 01:51 — forked from LukaHarambasic/functions.php
Wordpress: ACF-Field as CPT Title
// inspired by: https://gist.github.com/rveitch/9018669face1686e74aaa68026856f36
// add iitle to CPTs which doesn't provide a title (useful for the relationship field (https://www.advancedcustomfields.com/resources/relationship/))
function sync_acf_post_title($post_id, $post, $update) {
$post_type = get_post_type($post_id);
// check for the current CPT
if($post_type === "cpt_name_1") {