Skip to content

Instantly share code, notes, and snippets.

Francisco arenas dospuntocero

Block or report user

Report or block dospuntocero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dospuntocero
dospuntocero / complex query
Last active Jun 13, 2019
i have a product with 2 taxonomies and i need to filter the ones that belongs to one specific taxonomy and at the same time, order the objects by category
View complex query
<?php
/**
* Template Name: Product
*/
get_header();
?>
<main class="wrapper">
@dospuntocero
dospuntocero / ACF Country List
Created May 23, 2019 — forked from yaronguez/ACF Country List
Country list formatted for Advanced Custom Fields select dropdown
View ACF Country List
afghanistan : Afghanistan
albania : Albania
algeria : Algeria
american_samoa : American Samoa
andorra : Andorra
angola : Angola
anguilla : Anguilla
antigua_and_barbuda : Antigua and Barbuda
argentina : Argentina
armenia : Armenia
@dospuntocero
dospuntocero / search.php
Created May 20, 2019
order wordpress posts using url variables
View search.php
//passing variables like ?orderby=title
$my_query = new WP_Query( array(
'post_type' => 'project',
'post_status' => 'publish',
'orderby' => get_query_var('orderby'), // will return orderby query string variable
'order' => 'DESC',
'paged' => get_query_var('paged'),
));
@dospuntocero
dospuntocero / changing the language of windows 10
Last active May 31, 2019
changing the keyboard configuration on windows 10 - for good. using powershell
View changing the language of windows 10
if you want to know which keyboards do you have available, use this command
Get-WinUserLanguageList
if you want to add a new one and you know the languagetag and the keyboard layout you want you can use something like this
Set-WinUserLanguageList -LanguageList en-US, en-001 -Force
if you want to remove from the list of posibilities the ones you dont want to use, just do the following (pressing enter after each line):
@dospuntocero
dospuntocero / add sort order on wordpress
Last active May 31, 2019
combination of parts needed to add a new parameter on the wordpress url for sorting.
View add sort order on wordpress
<?php
//adds the orderby parameter to the url for the sorting
function add_orderby() {
if ( isset( $_GET['orderby'] ) ) {
if ( in_array( $_GET['orderby'],[]) ) {
set_query_var( 'orderby', 'meta_value_num' );
set_query_var( 'meta_key', $_GET['orderby'] );
}
}
@dospuntocero
dospuntocero / singlefield.php
Last active May 31, 2019
solution found on advanced custom fields support forum. kudos to EbbandFlow
View singlefield.php
<?php
//For use with a single field.
$video = get_field('video'); //Embed Code
$video_url = get_field('video', FALSE, FALSE); //URL
$video_thumb_url = get_video_thumbnail_uri($video_url); //get THumbnail via our functions in functions.php ?>
<?php //Lightbox Link via Thumbnail ?>
<a href="#lightbox"><img src="<?php echo $video_thumb_url; ?>"/></a>
@dospuntocero
dospuntocero / youtube-id.php
Created Mar 3, 2019 — forked from leogopal/youtube-id.php
PHP function to get youtube ID from URL
View youtube-id.php
<?php
function get_youtube_video_ID($youtube_video_url) {
/**
* Pattern matches
* http://youtu.be/ID
* http://www.youtube.com/embed/ID
* http://www.youtube.com/watch?v=ID
* http://www.youtube.com/?v=ID
* http://www.youtube.com/v/ID
* http://www.youtube.com/e/ID
@dospuntocero
dospuntocero / multiposttype
Created Feb 27, 2019
Query multiple custom post types in single loop
View multiposttype
<?php
$args = array(
'post_type' => array('testimonial', 'other_post_type', 'another-post-type'),
'posts_per_page' => 1,
'tax_query' => array(
array (
'taxonomy' => 'testimonial_category',
'field' => 'slug',
'terms' => 'home'
)
@dospuntocero
dospuntocero / generic post type loop
Last active May 31, 2019
generic post type loop
View generic post type loop
<?php
$loop = new WP_Query( array(
'post_type' => 'the post type',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
@dospuntocero
dospuntocero / extend image
Created Feb 24, 2019
used this technique to expand an image to fill the whole div and maintain aspect ratio
View extend image
.full-image-div{
width:100%;
height:100%;
object-fit: cover;
overflow: hidden;
}
You can’t perform that action at this time.