Skip to content

Instantly share code, notes, and snippets.

View imarkdesigns's full-sized avatar

Mark Joseph Rivera imarkdesigns

View GitHub Profile
@imarkdesigns
imarkdesigns / menu.php
Created November 1, 2020 22:48
WP Custom Logo #wp
// WP Custom Logo
$customLogoID = get_theme_mod( 'custom_logo' );
$logo = wp_get_attachment_image_src( $customLogoID, 'full' );
@imarkdesigns
imarkdesigns / functions.php
Created October 1, 2020 20:55
Allow .vcf to WordPress #wordpress
/**
* Enable vCard Upload
*
*/
function be_enable_vcard_upload( $mime_types ){
$mime_types['vcf'] = 'text/x-vcard';
return $mime_types;
}
add_filter('upload_mimes', 'be_enable_vcard_upload' );
@imarkdesigns
imarkdesigns / downloadTrigger
Created April 17, 2020 17:55
Force Download via jQuery #jquery
var downloadTrigger = getUrlParameter('download');
if ( downloadTrigger == 'true' ) {
function download_file(fileURL, fileName) {
// for non-IE
if (!window.ActiveXObject) {
var save = document.createElement('a');
save.href = fileURL;
save.target = '_blank';
var filename = fileURL.substring(fileURL.lastIndexOf('/')+1);
save.download = fileName || filename;
@imarkdesigns
imarkdesigns / mailhog-mamp.md
Created November 29, 2019 22:27 — forked from jaredatch/mailhog-mamp.md
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update
@imarkdesigns
imarkdesigns / post.php
Created September 25, 2019 04:56
Word Count #wp #php
<?php
// Use AdvancedCustomFields for the content
$word_count = str_word_count( strip_tags( get_field('content') ) );
if ($word_count > 39) {
echo '<p><a href="'.get_permalink().'">Read More</a></p>';
}
?>
@imarkdesigns
imarkdesigns / post.php
Created September 25, 2019 01:19
Paginate Custom Post Types from CSS-Tricks #wp #php
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('showposts=6&post_type=news'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<!-- LOOP: Usual Post Template Stuff Here-->
@imarkdesigns
imarkdesigns / glossary.less
Created September 23, 2019 22:57
WP Glossary #wp #php
//########## Glossary
@nas-brand: #90C43D;
@nas-info: #AD9D90;
.flex ( @direction : row; @wrap : no-wrap; @justify : flex-start; @content : flex-start; @items : flex-start; ) {
display: flex;
flex-direction: @direction;
flex-wrap: @wrap;
justify-content: @justify;
@imarkdesigns
imarkdesigns / ST3-Config
Created March 24, 2019 17:24
Sublime Text 3 Config Setup (Personal)
{
"color_scheme": "Packages/Theme - One Dark/One Dark.tmTheme",
"font_face": "Fira Code Light",
"font_options":
[
"no_italic",
"gray_antialias"
],
"font_size": 9,
"highlight_line": true,
@imarkdesigns
imarkdesigns / wp-config.php
Created July 25, 2018 03:15
WP Config #wp #php
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
@imarkdesigns
imarkdesigns / app.php
Created April 30, 2018 12:52
A PHP 7.1 Encrypter for Laravel 4.2 #laravel
<?php
// Add service provider
// Add the following to your providers in the app config
\Tomgrohl\Laravel\Encryption\EncryptionServiceProvider::class
// Check Encryption Key settings in app config
// Cipher must either be ‘AES-128-CBC’ with a key length of 16
// OR
// Cipher must either be ‘AES-256-CBC’ with a key length of 32