Skip to content

Instantly share code, notes, and snippets.

@katojune
katojune / custom-post-type.php
Created February 22, 2017 19:44 — forked from saimonh3/custom-post-type.php
WordPress Custom Post Type
<?php
//Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function dwwp_register_post_type() {
$singular = 'Job';
$plural = 'Jobs';
$slug = str_replace( ' ', '_', strtolower( $singular ) );
@katojune
katojune / wp-custom-post-type.php
Created February 22, 2017 19:33 — forked from madeinnordeste/wp-custom-post-type.php
Wordpress - Custom post type
<?php
//in theme functions.php
// @see http://codex.wordpress.org/Function_Reference/register_post_type
$labels = array(
'name' => _x('Edição Digital', 'Edição Digital'),
'singular_name' => _x('edicao_digital', 'Edição Digital'),
'add_new' => _x('Nova Edição Digital', 'edicao_digital'),
'add_new_item' => __('Adicionar nova Edição Digital'),
# Robots Rule! - Sometimes... #
User-agent: *
Allow: /
# Disallow these directories, url types & file-types
Disallow: /cgi-bin
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/
Disallow: /search/*/feed
@katojune
katojune / .htaccess
Last active August 29, 2015 14:08 — forked from ScottPhillips/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(
<?php
add_action( 'init', 'register_cpt_example' );
function register_cpt_example() {
//// Label parameters for the CPT admin
$labels = array(
'name' => _x( 'Examples', 'example' ),
'singular_name' => _x( 'Example', 'example' ),
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your