Skip to content

Instantly share code, notes, and snippets.

Francisco arenas dospuntocero

View GitHub Profile
dospuntocero / remove-h1.php
Created Jun 28, 2019
how to remove h1 from the wordpress classic editor
View remove-h1.php
function remove_h1_from_editor( $settings ) {
$settings['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;';
return $settings;
add_filter( 'tiny_mce_before_init', 'remove_h1_from_editor' );
dospuntocero / features-list.php
Created Jun 27, 2019
getting a list of features from an ACF repeater and split it in 2 different balanced lists
View features-list.php
<div class="solution-features-list">
$features = [];
if ( have_rows( 'features' ) ) :
while ( have_rows( 'features' ) ) : the_row();
array_push($features, get_sub_field( 'feature' ));
dospuntocero / show-children-pages.php
Last active Jun 27, 2019
show children pages of current page
View show-children-pages.php
<div class="solutions-holder">
<div class="wrapper">
$args = [
'post_parent' => $post->ID,
'post_type' => 'page',
'orderby' => 'menu_order'
$child_query = new WP_Query( $args );
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
* Template Name: Product
<main class="wrapper">
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 / 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 / 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
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 / 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
//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 / singlefield.php
Last active May 31, 2019
solution found on advanced custom fields support forum. kudos to EbbandFlow
View singlefield.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 / 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
function get_youtube_video_ID($youtube_video_url) {
* Pattern matches
You can’t perform that action at this time.