This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// valid outside the loop | |
$page_object = get_queried_object(); | |
$page_id = get_queried_object_id(); | |
$ID = get_the_ID(); //get the post ID | |
$post = get_post( $ID )->post_content; // default is post object | |
// var_dump( get_post( $post->post_content ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
fallback order: | |
use post thumbnail(featured post) if available, otherwise | |
use first attachment image if available, otherwise | |
use first image link if available, otherwise | |
stay blank... | |
*/ | |
// inside a loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// redirect to somewhere else if calling path is not valid(as expected) | |
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; | |
DEFINE('HTTP_ROOT', $_SERVER['HTTP_HOST']); | |
$path_arr = explode("/", $_SERVER['REQUEST_URI']); | |
$url_chk = in_array("path-name", $path_arr); | |
$location = $protocol . HTTP_ROOT . '/somewhere-to-redirect/'; | |
if( !$url_chk ) header("Location: $location"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../topeka-elements/category-images.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../core-icons/av-icons.html"> | |
<link rel="import" href="../paper-fab/paper-fab.html"> | |
<link rel="import" href="../paper-calculator/paper-calculator.html"> | |
<polymer-element name="my-element"> | |
<template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Purpose: Remove Wordpress Update Message under Admin Bar(Top Menu Bar) | |
Version Tested: 3.6 | |
Reference: | |
http://www.wpbeginner.com/wp-tutorials/how-to-hide-the-wordpress-upgrade-message-in-the-dashboard/ | |
http://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices | |
*/ | |
function wp_custom_admin_hide_update() { | |
remove_action( 'admin_notices', 'update_nag', 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Purpose: Remove edit field in post edit page, example is "title" and "editor" | |
Version Tested: 3.8 | |
Original Reference: | |
http://wordpress.org/support/topic/remove-title-and-edit-box-from-edit-post-screen?replies=6 | |
*/ | |
function wp_remove_input_field() | |
{ | |
remove_post_type_support('post', 'title'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Purpose: Disable metabox dragging order save to DB | |
Version Tested: 3.8 | |
Original Reference: | |
1 http://wordpress.stackexchange.com/questions/2025/removing-metabox-for-slug-without-removing-functionality | |
2 http://wordpress.stackexchange.com/questions/2474/disable-dragging-of-meta-boxes | |
3 http://stackoverflow.com/questions/3399851/how-do-i-stop-wordpress-dashboard-widgets-from-being-dragged/3477209#3477209 | |
*/ | |
function wp_prevent_meta_box_order_save($action) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Purpose: modify text, it modify the output from the translated text pool | |
Version Tested: 3.8 | |
Original Reference: | |
http://botcrawl.com/how-to-change-the-posts-menu-title-to-articles-in-the-wordpress-dashboard/ | |
*/ | |
function change_post_to_article($translated) { | |
$translated = str_ireplace('Post', 'Article', $translated); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Version Tested: 3.6, 3.8 | |
*/ | |
/* Display custom column */ | |
function display_posts_stickiness( $column, $post_id ) { | |
the_author(); | |
} | |
add_action( 'manage_posts_custom_column' , 'display_posts_stickiness', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
top admin toolbar aka admin bar | |
remove unnecessary admin toolbar items | |
Version Tested: 3.6, 3.8 | |
Reference: | |
http://wordpress.stackexchange.com/questions/47824/modify-admin-bar-link | |
*/ | |
function custom_admin_bar_link() { | |
global $wp_admin_bar; |
OlderNewer