Skip to content

Instantly share code, notes, and snippets.

View allysonsouza's full-sized avatar
💻
Doing some WordPress stuff...

Allyson allysonsouza

💻
Doing some WordPress stuff...
View GitHub Profile
@allysonsouza
allysonsouza / archive-conditionals.php
Last active June 6, 2017 09:49
WordPress Archive Title conditionals to correct display
<?php
function archive_title() {
//Conditionals to Title Display in WordPress Archive Templates
if( is_archive() ) {
$queried_object = get_queried_object();
if( is_tag() ) {
$slug = $queried_object ? $queried_object->slug : ' ' ;
@allysonsouza
allysonsouza / example-page-template-archive.php
Last active August 29, 2015 14:03
Page Template as Archive for CPT
<?php
/* Este é o conteúdo de uma template page a ser exibido por uma página com slug = 'portfolio', tal como o post_type
A criação do CPT está com o argumento 'has_archive' => false, e a template page funciona normalmente, exceto quando é necessário
exibir uma página que não seja a primeira: www.meusite.com.br/portfolio/page/2 etc.
*/
//Pagination
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
@allysonsouza
allysonsouza / multidimensional-empty-array.js
Last active August 29, 2015 14:03
Multidimensional Empty Arrays in JavaScript
var App = {
cols: 3,
init: function() {
var siblings = [];
for(var i = 0; i < this.stage.rows; i++) {
siblings[i] = [];
}
@allysonsouza
allysonsouza / filters.xml
Last active December 14, 2015 23:46
FileZilla - Odin Framework Filter
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!--
FileZilla Filter for Odin Framework
Insira o conteúdo das tags <Filters>...</Filters> dentro das mesmas tags no arquivo filters.xml do seu FileZilla, ou caso
não deseje utilizar os filtros padrão, substitua o arquivo.
Para saber onde os arquivos de configuração de seu FileZilla estão: https://wiki.filezilla-project.org/FAQ
**Obs: Também é possível alterar o diretório de configurações do seu FileZilla, veja: https://forum.filezilla-project.org/viewtopic.php?f=1&t=8433
@allysonsouza
allysonsouza / icon-font-associative-array.php
Created July 28, 2014 18:30
Icon Font Associative Array
<?php
/**
* Return an associative array with name and code of the icon from the icon font given in $path argument
*
* @version 0.0.1
*
* @return array Associative array, in the form [name] => [code] of the icon font
*/
function icon_array( $path ) {
@allysonsouza
allysonsouza / game-loop.js
Last active August 29, 2015 14:04
Ensaios de um pattern de Game Loop no JavaScript
(function () {
'use strict';
/*
* ImageRect
*/
function ImageRect() {
this.sx = 3584; //source x
this.sy = 0; //source y
this.sw = 512; //source width
@allysonsouza
allysonsouza / class-metabox.php
Created August 19, 2014 21:26
Odin Metabox - Show by screen id
<?php
/**
* Odin_Metabox class.
*
* Built Metaboxs.
*
* @package Odin
* @category Metabox
* @author WPBrasil
* @version 2.1.4
@allysonsouza
allysonsouza / register-cpt-example.php
Created October 7, 2014 14:35
Register Post Type Example
<?php
public function create_post_type() {
$labels = array(
'name' => 'Archives',
'singular_name' => 'Archive',
'menu_name' => 'Archives',
'name_admin_bar' => 'Archives',
'add_new' => 'Add New',
'add_new_item' => 'Add New Archive',
'new_item' => 'New Archive',
@allysonsouza
allysonsouza / wordpress-show-template.php
Last active September 27, 2021 17:58
[WordPress Template] Shows which template WordPress is using to show the current site content #wordpress
<?php
add_action('wp_head', function() {
global $template;
echo $template;
});
?>
@allysonsouza
allysonsouza / remove-enqueued-style.php
Created October 14, 2014 17:52
Remove enqueued theme style in WordPress
<?php
global $wp_styles;
$num = count($wp_styles->queue);
for( $i = 0; $i < $num; $i++){
if( $wp_styles->queue[$i] != 'admin-bar' ){
unset($wp_styles->queue[$i]);
}
}