Skip to content

Instantly share code, notes, and snippets.

Avatar

Keramot UL Islam AbmSourav

View GitHub Profile
@AbmSourav
AbmSourav / gatsby-node.js
Created Sep 10, 2020
Dynamic pages with GatsbyJS
View gatsby-node.js
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
const wpData = await graphql(`
{
allWordpressPost {
nodes {
wordpress_id
slug
title
@AbmSourav
AbmSourav / facebook_feed.php
Last active Mar 30, 2020
using Facebook Rest API create Facebook Page Feed in WordPress websites.
View facebook_feed.php
<?php
$facebook_feed = get_transient( '_facebook_cash' );
$url_queries = 'fields=status_type,created_time,from,message,story,full_picture,permalink_url,attachments.limit(1){type,media_type,title,description,unshimmed_url},comments.summary(total_count),reactions.summary(total_count)';
$page_id = 'your facebook page id';
$token = 'your access token';
$url = 'https://graph.facebook.com/v4.0/' . $page_id . '/posts?' . $url_queries . '&access_token=' . $token;
if ( false === $facebook_feed ) {
$fb_posts = wp_remote_get( $url );
@AbmSourav
AbmSourav / SSH Key
Last active Mar 18, 2020
SSH key detail
View SSH Key
Create SSH key: ssh-keygen -t rsa -C "your_email@example.com"
Ubuntu Copy SSH: xclip -sel clip < ~/.ssh/id_rs.pub
Windows Copy SSH: clip < ~/.ssh/id_rsa.pub
@AbmSourav
AbmSourav / autoload
Created Nov 17, 2019
PHP Class autoload
View autoload
<?php
// classes/greatings.php
namespace Classes;
class Greatings {
function hello() {
return "Successfully called Greatings";
}
View WordPress Rest API
// function.php wp_enqueue_scripts
wp_localize_script( 'main-js', 'rootUrl', array(
'siteUrl' => get_site_url()
) );
// main.js
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', rootUrl.siteUrl + '/wp-json/wp/v2/posts');
ourRequest.onload = function() {
@AbmSourav
AbmSourav / comments.php
Created Jun 20, 2018
WordPress Comments Fields with Bootstrap classes
View comments.php
<div class="row">
<div class="col-md-8 comment-form">
<?php
$fields = array(
'author' =>
'<div class="form-group"><label for="author">' . __( 'Name', 'domainreference' ) . '</label> <span class="required">*</span> <input id="author" name="author" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author'] ) . '" required="required" /></div>',
'email' =>
'<div class="form-group"><label for="email">' . __( 'Email', 'domainreference' ) . '</label> <span class="required">*</span><input id="email" name="email" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" required="required" /></div>',
@AbmSourav
AbmSourav / content.php
Created May 30, 2018
password form is not showing
View content.php
<?php
$alpha_title_text = 'card-title';
$alpha_content_text = 'card-text';
$alpha_meta_wrap = 'card-footer text-muted';
if ( !is_active_sidebar( 'sidebar-1' ) ) {
$alpha_title_text = 'text-center';
$alpha_content_text = 'text-center';
$alpha_meta_wrap = 'text-center';
You can’t perform that action at this time.