Skip to content

Instantly share code, notes, and snippets.

View dospuntocero's full-sized avatar

Francisco arenas dospuntocero

View GitHub Profile
@dospuntocero
dospuntocero / singlefield.php
Last active July 28, 2024 18:16
solution found on advanced custom fields support forum. kudos to EbbandFlow
<?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>
Install dependencies:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install libaio1 libncurses5 libnss3-tools rsync shared-mime-info desktop-file-utils libxshmfence1 libglu1 libatk1.0-0 libatk-bridge2.0-0 libgtk2.0-0 libgtk-3-0 libgbm-dev libasound2 libnuma-dev libxslt1.1 lxqt-sudo libzip4
sudo apt --fix-broken install
sudo apt install wget
sudo apt install curl
@dospuntocero
dospuntocero / gist:656294ac763085cba4b0b005f27a5166
Created March 7, 2020 11:01
“Parsing filters unsupported” error during extraction of RAR file - FIX Ubuntu
in terminal:
sudo apt-get install unrar
or
sudo apt-get install unar
Then for using with archive manager: sudo apt-get install file-roller
@dospuntocero
dospuntocero / symlink.md
Created March 25, 2020 20:54
how to create a symlink in windows
@dospuntocero
dospuntocero / gist:bbd8ccfd8cff725db7b9448fc74640c5
Created April 10, 2021 03:13
how to enable ubuntu over WSL with phpstorm for proper file lineendings and a decent super fast workflow
Usage
You need git to be installed for the commands below to work. Use
sudo apt install git
to do so.
Run the script and commands
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
@dospuntocero
dospuntocero / get_template_part wp5.5.php
Created October 5, 2020 10:50
passing parameters to wordpress's get_template_part on version 5.5+
//the third variable is an array where you can pass any variables or complete objects
<?php get_template_part('template-parts/featured-image',null,[
'subHead' => get_field('title_sub-head')
]); ?>
//in the part, you use the key $args to pass the parameters.
<?php if ( has_post_thumbnail( $post->ID ) ) : ?>
<section class="hero" style="background-image: url(<?php the_post_thumbnail_url(); ?>);">
<?php echo $args['subHead']; // here you pass the arguments with the variable $args?>
</section>
@dospuntocero
dospuntocero / next_prev.php
Created August 22, 2020 16:19
next prev buttons for posts or pages in wordpress
<?php
//next prev buttons
$pagelist = get_posts('sort_order=asc');//use get_pages for pages
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
sudo apt install ruby
sudo apt install rbenv
sudo apt install ruby-railties
sudo apt install ruby-dev
sudo gem install rails -v 6.0.0
rbenv rehash
rails -v
@dospuntocero
dospuntocero / html editor main config
Created January 27, 2013 16:40
dospuntoceroCMS HtmlEditorConfig
class DospuntoceroCMS extends LeftAndMainExtension{
function alternateAccessCheck(){
// html display simplification
$lines = array('pastetext','ssmedia','separator','bold','italic','underline','strikethrough','hr','separator','styleselect','formatselect','separator','bullist','numlist','blockquote','sslink','unlink','anchor','separator','code');
$config = HtmlEditorConfig::get('cms');
$config->setButtonsForLine(1, $lines);
$config->setButtonsForLine(2, 'tablecontrols');
$config->setButtonsForLine(3, null);
@dospuntocero
dospuntocero / setup.php
Created May 1, 2020 21:36
remove main editor wordpress
add_action( 'init', function() {
remove_post_type_support( 'page', 'editor' );
}, 10);