Skip to content

Instantly share code, notes, and snippets.

View Aziz-Rahman's full-sized avatar

Aziz Rahman Aji Aziz-Rahman

View GitHub Profile
@Aziz-Rahman
Aziz-Rahman / taxonomy_tags.php
Created December 2, 2015 04:38
Displayrelated post by taxonomy tag
<?php
// Get taxonomy tags
$taxonomy = 'photo-tag';
$terms = get_terms($taxonomy);
shuffle($terms);
if ($terms) {
foreach($terms as $term) {
$tags = $term->slug;
}
}
@Aziz-Rahman
Aziz-Rahman / pagination.php
Created November 26, 2015 07:29
Sample pagination
<!-- Page Features -->
<div id="my-product" class="row grid text-center">
<div class="Collage effect-parent col-lg-12 inner-full-width"> <!-- START: FULL WIDTH -->
<?php
include "includes/conn.php";
$batas = 8;
$pg = isset( $_GET['pg'] ) ? $_GET['pg'] : "";
if ( empty( $pg ) ) {
@Aziz-Rahman
Aziz-Rahman / htaccess.txt
Created November 24, 2015 09:07
smple htaccess
RewriteEngine on
RewriteRule ^about/$ /pages/about.html [L]
RewriteRule ^features/$ /features.php [L]
RewriteRule ^buy/$ /buy.html [L]
RewriteRule ^contact/$ /pages/contact.htm [L]
Baris ke-2 : http://yoursite.com/pages/about.html -> http://yoursite.com/about
Baris ke- : http://yoursite.com/features.php-> http://yoursite.com/features
Baris ke- : http://yoursite.com/buy.html-> http://yoursite.com/buy
Baris ke- : http://yoursite.com/pages/contact.html-> http://yoursite.com/contact
@Aziz-Rahman
Aziz-Rahman / overlayimg.html
Last active November 27, 2015 12:04
sample text center in overlay
<div class="item">
<img src="images/1e1dd042704d8bc621f126d2beada5eb.jpg" alt="Owl Image">
<div class="overlay-slider">
<span class="table-overlay">
<span class="tablecell-overlay">
<h3>Feature Label</h3>
<a href="#" class="btn btn-primary">Buy Now!</a> <a href="#" class="btn btn-default">More Info</a>
</span>
</span>
</div>
@Aziz-Rahman
Aziz-Rahman / first_second.php
Last active December 8, 2015 07:17
Get first and second post
<?php
if (have_posts()) :
$counter = 1;
while (have_posts()) :
the_post();
@Aziz-Rahman
Aziz-Rahman / functions.js
Last active November 27, 2015 12:08
Effect add to cart
$('.add-to-cart').on('click', function () {
var cart = $('.shopping-cart');
var imgtodrag = $(this).parent('.item').find("img").eq(0);
if (imgtodrag) {
var imgclone = imgtodrag.clone()
.offset({
top: imgtodrag.offset().top,
left: imgtodrag.offset().left
})
.css({
@Aziz-Rahman
Aziz-Rahman / efcldr.php
Created November 2, 2015 01:59
Effect loader
<div id="preloader" style="position: fixed; width: 100%; height: 100%; z-index: 999; background-color: #fff; text-align: center;">
<div class="table">
<div class="table-cell">
<i class="preloader-icon fa fa-spinner fa-pulse"></i>
</div>
</div>
</div>
<!-- jQuery -->
$(window).load(function() {
@Aziz-Rahman
Aziz-Rahman / ckvalueexists.php
Created October 16, 2015 03:41
Check if exists value in wp
$args = array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'post_url', // custom post type
'value' => $the_url_topic // value yg diinputkan
)
),
'fields' => 'ids' // id from wp
);
@Aziz-Rahman
Aziz-Rahman / ogpxxx.js
Last active January 18, 2017 22:46
Get open grap from url with JSON
$('a#suggest_title').bind( "click", function(event) {
event.preventDefault();
// http://stackoverflow.com/questions/29997121/how-to-get-page-open-graph-metadata-via-jquery
var ogPostUrl = $('input#post_url').val();
$.getJSON("//query.yahooapis.com/v1/public/yql?"
+ "q=SELECT%20*%20FROM%20html%20WHERE%20url=%27"
+ encodeURIComponent(ogPostUrl)
+ "%27%20AND%20xpath=%27descendant-or-self::meta%27"
+ "&format=json&callback=?"
, function(data) {
@Aziz-Rahman
Aziz-Rahman / smpleprfx.php
Created October 12, 2015 06:45
Example table prefix in wp multisite/ not
<?php
if ( is_multisite() ) :
global $wpdb, $table_prefix;
$table_name = $table_prefix . 'postmeta'; // output wp_#_postmeta (multisite) # = id multisite (automatic)
$select_data = $wpdb->get_results( "SELECT meta_value FROM $table_name WHERE meta_value = '$warrior_url_topic'" );
$check_url_exists = $wpdb->num_rows;
foreach ( $select_data as $obj ) {
$wp_data = $obj->meta_value;
}