Skip to content

Instantly share code, notes, and snippets.

View manishsongirkar's full-sized avatar

Manish Songirkar manishsongirkar

  • rtCamp
  • Pune, India
  • 22:58 (UTC +05:30)
View GitHub Profile
@manishsongirkar
manishsongirkar / editor-check-gutenberg-markup.php
Created July 24, 2023 11:23
Highlight on pages lists in editor if page is having Gutenberg markup or not.
<?php
function ms_filter_posts_columns( $columns ) {
$columns['gutenberg_markup'] = __( 'Gutenberg Markup?', 'text-domain' );
return $columns;
}
function ms_page_column( $column, $post_id ) {
@manishsongirkar
manishsongirkar / custom-fontawesome.js
Last active September 1, 2023 08:53
Fetch FontAwesome icons through JSON and generate custom data object in console
document.addEventListener( 'DOMContentLoaded', function() {
var getPost = async function() {
var response = await fetch( 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/6.x/metadata/icons.json' );
var icons = await response.json();
let fontAwesomeObj = {};
let currentObject = fontAwesomeObj;
Object.entries( icons ).forEach( ( [ key, icon ] ) => {
const styles = icon.styles;
@manishsongirkar
manishsongirkar / block-post-meta-register.php
Created May 22, 2023 11:10
Toggle option below featured image to show/hide featured image on frontend
<?php
/**
* Register post meta for featured image display.
*/
function register_block_post_meta() {
register_post_meta(
'post',
'featuredImageDisplay',
[
@manishsongirkar
manishsongirkar / all-blocks-list.js
Last active February 29, 2024 15:56
Gutenberg Block List
// All block lists.
wp.blocks.getBlockTypes();
// All Core blocks only.
wp.blocks.getBlockTypes().filter((block) => { return block.name.indexOf('core') !== -1});
// All block list name only.
wp.blocks.getBlockTypes().filter((block) => { console.log( block.name ) });
// All block list name only EXCLUDING child block.
@manishsongirkar
manishsongirkar / custom-post-format.php
Created October 9, 2015 07:41
Custom Post Format
<?php
/**
* Rename Aside post format to Look post format
*/
function rtp_rename_post_formats( $safe_text ) {
if ( $safe_text == __( 'Aside' , 'fab' ) ) {
return __( 'Look' , 'fab' );
}
return $safe_text;
@manishsongirkar
manishsongirkar / custom-post-status.php
Last active November 1, 2017 21:34
WordPress custom Post Status
<?php
/**
* Add custom post status
*/
/**
* Register Custom Status
* Add custom post status to Product custom post type
*/
@manishsongirkar
manishsongirkar / Gruntfile.js
Created August 24, 2015 07:09
Grunt Settings
'use strict';
module.exports = function(grunt) {
// load all grunt tasks matching the `grunt-*` pattern
// Ref. https://npmjs.org/package/load-grunt-tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Fontello Icons
// Note: This is one time running task, so run grunt after update assets/fontello/config.json file
// Ref. https://npmjs.org/package/grunt-fontello
fontello: {
@manishsongirkar
manishsongirkar / equal-height.js
Last active April 6, 2018 10:01
Responsive Equal Height Element
/**
* Responsive Equal Height Element
*
* @param {type} container
* @returns {undefined}
*/
equalheight = function ( container ) {
var currentTallest = 0,
currentRowStart = 0,
@manishsongirkar
manishsongirkar / sticky-navigation
Created December 5, 2014 12:07
jQuery Sticky Navigation for my reference
/**
* Sticky Navigation
*
* @returns {undefined}
*/
$( function () {
// grab the initial top offset of the navigation
var sticky_navigation_offset_top = $( '#rtp-primary-menu' ).offset().top - 4;
@manishsongirkar
manishsongirkar / useragent.js
Last active August 29, 2015 14:07
Check UserAgent and apply class to body tag
jQuery( document ).ready( function() {
var isMobile = {
Android: function() {
return navigator.userAgent.match( /Android/i );
},
BlackBerry: function() {
return navigator.userAgent.match( /BlackBerry/i );
},
iOS: function() {
return navigator.userAgent.match( /iPhone|iPad|iPod/i );