Skip to content

Instantly share code, notes, and snippets.

View yellowberri-snippets's full-sized avatar

Dalton Yellowberri yellowberri-snippets

View GitHub Profile
@yellowberri-snippets
yellowberri-snippets / WP: SQL: Rename Custom Post Types
Created September 25, 2014 19:45
WP: SQL: Rename Custom Post Types
UPDATE `<wp_posts SQL Row>`
SET `post_type` = '<new post type name>'
WHERE `post_type` = '<old post type name>';
@yellowberri-snippets
yellowberri-snippets / WP: SQL: Rename Custom Taxonomy
Created September 25, 2014 19:44
WP: SQL: Rename Custom Taxonomy
UPDATE `<wp_term_taxonomy SQL Row>`
SET `taxonomy` = '<new taxonomy name>'
WHERE `taxonomy` = '<old taxonomy name>';
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Custom Post Type Definition
Created September 9, 2014 21:45
PHP: WP: Custom Post Type Definition
function cpt_book_init() {
$labels = array(
'name' => 'Books',
'singular_name' => 'Book',
'menu_name' => 'Books',
'name_admin_bar' => 'Book',
'add_new' => 'Add New', 'book',
'add_new_item' => 'Add New Book',
'new_item' => 'New Book',
'edit_item' => 'Edit Book',
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Get Page Template File Name
Last active March 9, 2021 02:34
PHP: WP: Get Page Template File Name
<?php
$template = get_page_template();
$template = explode('/', $template);
$template = end($template);
?>
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Display Multiple ACF Fields with Custom Label
Created June 11, 2014 21:29
PHP: WP: Display Multiple ACF Fields with Custom Label
<?php
$listedInfo = array(
'client' => 'Client',
'city' => 'Location',
'date' => 'Project Date',
'cost' => 'Construction Cost',
'size' => 'Building Size',
'schedule' => 'Construction Schedule'
);
<?php $postsPerPage = get_option('posts_per_page'); ?>
<title>
<?php
if (!is_front_page()) {
wp_title('');
echo " | ";
}
bloginfo('name');
echo " - ";
bloginfo('description');
?>
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Return Heading for Archive Pages : ybArchiveTitle()
Created June 2, 2014 17:16
PHP: WP: Return Heading for Archive Pages : ybArchiveTitle()
// Return term of Archive Page.
function ybArchiveTitle() {
$archiveTitle = "";
if ( is_category() ) {
$archiveTitle = single_cat_title('', FALSE);
}
elseif ( is_tag() ) {
$archiveTitle = single_tag_title('', FALSE);
}
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Get $paged Query Variable
Created May 28, 2014 20:58
PHP: WP: Get $paged Query Variable
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
@yellowberri-snippets
yellowberri-snippets / PHP: WP: yb_list_custom_taxonomy() Args
Created May 22, 2014 20:43
PHP: WP: yb_list_custom_taxonomy() Args
<?php
$args = array(
'postID' => '',
'customTax' => 'artwork_category',
'withLink' => TRUE,
'separator' => ' | ',
'exclude' => array()
);
yb_list_custom_taxonomy($args);