Skip to content

Instantly share code, notes, and snippets.

@andrastudio
andrastudio / content-status.php
Created November 5, 2014 04:23
Get featured image
$featured_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
@andrastudio
andrastudio / custom.css
Last active August 29, 2015 14:08
Merit - Make Event & Blog Posts Grid Align Centered
.post-grid {
margin: 0 auto;
text-align: center;
}
.post-grid article.hentry {
float: none;
display: inline-block;
text-align: left;
}
@andrastudio
andrastudio / canonical.php
Last active December 29, 2016 12:35
Fix pagination issue in WordPress 4.4.1 - wp-includes/canonical.php
// Post Paging
if ( is_singular() && get_query_var('page') && ( !is_front_page() || ( isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front') ) ) ) {
if ( !$redirect_url )
$redirect_url = get_permalink( get_queried_object_id() );
$page = get_query_var( 'page' );
if ( is_front_page() ) {
$redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' );
} else {
$redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( $page, 'single_paged' );
}
@andrastudio
andrastudio / Envato Link.html
Last active June 16, 2020 00:43
Envato Buy Now Link to Checkout Page
@andrastudio
andrastudio / vc-fonts.php
Created September 19, 2016 02:07
Add new google fonts to Visual Composer Custom Heading
if ( ! function_exists( 'helper_vc_fonts' ) ) {
function helper_vc_fonts( $fonts_list ) {
$poppins->font_family = 'Poppins';
$poppins->font_types = '300 light regular:300:normal,400 regular:400:normal,500 bold regular:500:normal,600 bold regular:600:normal,700 bold regular:700:normal';
$poppins->font_styles = 'regular';
$poppins->font_family_description = esc_html_e( 'Select font family', 'helper' );
$poppins->font_style_description = esc_html_e( 'Select font styling', 'helper' );
$fonts_list[] = $poppins;
return $fonts_list;
<?php
/**
* Plugin installation and activation for WordPress themes.
*
* Please note that this is a drop-in library for a theme or plugin.
* The authors of this library (Thomas, Gary and Juliette) are NOT responsible
* for the support of your plugin or theme. Please contact the plugin
* or theme author for support.
*
* @package TGM-Plugin-Activation
@andrastudio
andrastudio / smb.conf.template
Created November 7, 2016 12:52
Samba Configuration Template
[global]
netbios name = |NAME|
display charset = |CHARSET|
interfaces = |INTERFACES|
server string = |DESCRIPTION|
unix charset = |CHARSET|
workgroup = |WORKGROUP|
browseable = yes
deadtime = 30
domain master = yes
@andrastudio
andrastudio / facebook-page-like-auto-invite.js
Created May 3, 2017 04:07
Auto Invite People Who Have Liked a Post in Your Facebook Page
var buttons;
buttons = document.getElementsByClassName('_42ft');
for (var i = 0; i < buttons.length; i++) {
if(buttons[i].getAttribute('ajaxify') != null){
if(buttons[i].getAttribute('ajaxify').indexOf('invite') != -1){
buttons[i].click();
}
}
}
@andrastudio
andrastudio / custom.css
Last active April 19, 2018 08:31
Buat tampilan produk di mobile device pada theme Cepatlakoo menjadi 1 produk per kolom
@media screen and (max-width: 480px) {
.woocommerce #products-area ul.products li.product,
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.woocommerce-page[class*=columns-] ul.products li.product,
.woocommerce[class*=columns-] ul.products li.product,
.woocommerce #products-area ul.products li.product,
#main #contentarea .related.products ul.products li.product,
.woocommerce ul.products.column-4 li.product,
.woocommerce ul.products.column-4 li.product:nth-child(3n+3) {
@andrastudio
andrastudio / wa.php
Last active November 8, 2019 11:53
wassenger API via curl
$data = array("phone" => "+6281290004782", "message" => "Hai pak, apa kabar?");
$data_string = json_encode($data);
$ch = curl_init('https://api.wassenger.com/v1/messages');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Token: your-api-token',