Skip to content

Instantly share code, notes, and snippets.

View samikeijonen's full-sized avatar
🏠
Working from home

Sami Keijonen samikeijonen

🏠
Working from home
View GitHub Profile
@samikeijonen
samikeijonen / multisite-user-meta.php
Last active May 18, 2022 00:12
Example plugin for using multisite user meta
<?php
/**
* Plugin Name: Multisite User Meta
* Plugin URI: https://foxland.fi/user-meta-in-wordpress-multisite/
* Description: Test multisite user meta with text value.
* Version: 1.0.0
* Author: Sami Keijonen
* Author URI: https://foxland.fi/
* Text Domain: multisite-user-meta
* Domain Path: /languages
@samikeijonen
samikeijonen / entry-meta.php
Created January 6, 2016 19:15
Entry meta for Kuorinka theme without entry date
<?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta">
<?php
/* Set up byline. */
printf( '<span class="byline"><span class="entry-author" ' . hybrid_get_attr( 'entry-author' ) . '><span class="screen-reader-text">%1$s </span><a class="entry-author-link" href="%2$s" rel="author" itemprop="url"><span itemprop="name">%3$s</span></a></span></span>',
esc_html_x( 'Author', 'Used before post author name.', 'kuorinka' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
?>
@samikeijonen
samikeijonen / front-page.php
Created November 1, 2015 09:30
Example front-page.php template where articles comes firsts.
<?php
/**
* Template Name: Front Page
*
* Show pages info. You can set it under Appearance >> Customize.
*
* @package Mina olen
* @subpackage Template
* @since 1.0.0
textarea,
input[type="text"],
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="search"] {
-webkit-appearance: none;
border-radius: 0;
}
<?php
/**
* Enqueue scripts.
*/
function prefix_scripts() {
// Enqueue responsive navigation.
wp_enqueue_script( 'prefix-navigation', get_template_directory_uri() . '/js/responsive-nav.js', array(), '1.38', true );
// Enqueue JS functions.
@samikeijonen
samikeijonen / placeholders.php
Last active August 26, 2015 08:46
Add placeholders for comment form
<?php
function sonsa_comment_form_fields( $fields ) {
// Required field.
$req = get_option( 'require_name_email' );
// Add placeholder for name.
$fields['author'] = str_replace(
'<input',
@samikeijonen
samikeijonen / enable-lightbox.php
Last active August 29, 2015 14:27
Enable Simple Lightbox in feature image when on singular page.
/**
* Enable lightbox in feature image when on singular page.
*
* @see: https://wordpress.org/support/topic/help-activating-slb-in-my-theme?replies=14
*/
function toivo_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
@samikeijonen
samikeijonen / custom-home-link.php
Created July 27, 2015 09:36
Add home icon (minus the text) to the navigation using Custom link
@samikeijonen
samikeijonen / content.php
Created July 20, 2015 13:34
Example content.php using the excerpt
<div class="entry-summary" <?php hybrid_attr( 'entry-summary' ); ?>>
<?php
the_excerpt();
?>
</div><!-- .entry-summary -->
Example codes for article Learning accessibility in WordPress themes, part I.