Skip to content

Instantly share code, notes, and snippets.

@gj84
gj84 / wp_link_pages_titled.php
Last active December 14, 2016 17:25
New way to use wp_link_pages to get titleone titletwo as pagination in wordpress
@hofmannsven
hofmannsven / README.md
Last active May 15, 2019 06:41
How to create a Post Like System for WordPress.
@pwenzel
pwenzel / meta.php
Created May 22, 2014 21:02
Wordpress meta tags without a plugin
<?php
/**
* @link Escape post content in META Attributes, http://codex.wordpress.org/Data_Validation
* @link Complete List of HTML Meta Tags, https://gist.github.com/kevinSuttle/1997924
* @example get_template_part('meta');
*/
?>
<meta name="twitter:card" content="summary">
<!--<meta name="twitter:site" content="@YOUR_TWITTER_HANDLE">-->
@shizhua
shizhua / add-to-menu.php
Last active September 24, 2021 08:27
WordPress AJAX Login/Register
<?php
/**
* Automatically add a Login link to Primary Menu
*/
add_filter( 'wp_nav_menu_items', 'pt_login_link_to_menu', 10, 2 );
function pt_login_link_to_menu ( $items, $args ) {
if( ! is_user_logged_in() && $args->theme_location == apply_filters('login_menu_location', 'primary') ) {
$items .= '<li class="menu-item login-link"><a href="#pt-login">'.__( 'Login/Register', 'ptheme' ).'</a></li>';
}
return $items;
@halusdm10
halusdm10 / Wordpress-adsens
Last active December 31, 2017 12:06
wordpress
<?php
//Create an ad unit
//Place this code in a file functions.php
function wptuts_simple_ads( $ad_type ) {
switch ( $ad_type ) {
case "468x60":
$ad_code = "<!-- Ad code for a 468x60 advertisement. -->";