Skip to content

Instantly share code, notes, and snippets.

View dvdopi's full-sized avatar

David Odhiambo dvdopi

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="navbar" height="100px" />
<Content type="html"><![CDATA[
<head>
<style type="text/css">
#nav a {
@dvdopi
dvdopi / gist:41109114eae197ea668a3aca4408b358
Created April 17, 2020 08:39
Center Align Div - CSS for Containing div of whatever you want to center vertically and horrizontally
.center {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@dvdopi
dvdopi / gist:241c33b0fab46f43dd8a525cb110aa2f
Last active April 17, 2020 08:42
wordpress- query by custom taxomimy
$member = new WP_Query(
array(
'post_type' => 'post',
'orderby' => 'menu_order',
'order' => 'DESC',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'taxonomy',
@dvdopi
dvdopi / gist:312bdad0e74214490320ba4ceabc250f
Created April 17, 2020 08:43
Wordpress - get custom post type
the_field('cpt_slug', get_the_ID())
@dvdopi
dvdopi / gist:9386bc62ae717c95fa2e76a9aa29030a
Created April 17, 2020 08:45
wordpress -get object of Advance custom field
$field = get_field_object('custom field name');
$field = $field['value'];
@dvdopi
dvdopi / gist:a9f6dc9153beed19a423635c5ab6595c
Created April 17, 2020 08:46
wordpress - get taxonomy of a post type
get_terms([
'taxonomy' => 'gallery-item',
'hide_empty' => false,
]);
@dvdopi
dvdopi / gist:9076f7daa428a2df6a47af344dbdbf17
Created April 17, 2020 08:48
wordpress - get all taxonomy items of a particular taxonomy
$categories = get_terms(array(
'taxonomy' => 'taxonomy-slug',
'hide_empty' => false,
'order' => 'DESC'
));
foreach ($categories as $category) {
Print_r($category);
}
##Git global setup
git config --global user.name "Yourname"
git config --global user.email "email"
##Create a new repository
git clone <httpslink>
cd directory
touch README.md
git add README.md
git commit -m "add README"
@dvdopi
dvdopi / gist:b6af5b8c5230e7bb2677703886a8f92f
Created May 19, 2020 11:03
Angular htaccess that eliminates 404 on page refresh or when accessing inner links
<IfModule mod_rewrite.c>
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html
# to allow html5 state links