Skip to content

Instantly share code, notes, and snippets.

View version-control's full-sized avatar

version-control version-control

View GitHub Profile
@version-control
version-control / WP_Flexbox.html
Last active December 17, 2017 07:35
WP Loop With Flexbox (Mobile) / Category Type
<div class="container-fluid">
<?php get_header(); ?>
<div class="row">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="col-xs-6 col-sm-6 col-md-2 col-lg-2 justify-content: center">
@version-control
version-control / WP_Replace_Excerpt_Function.php
Last active December 17, 2017 07:24
WP Theme Function For Excerpt Replace "Read More"
/**
* Filter the "read more" excerpt string link to the post.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
return sprintf( '<a class="read-more" href="%1$s">%2$s</a>',
get_permalink( get_the_ID() ),
__( 'Read More', 'textdomain' )
@version-control
version-control / WP_Excerpt_Length.php
Created December 17, 2017 07:28
WP Theme Function For Excerpt Word Length
/**
* Filter the except length to 10 words.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function wpdocs_custom_excerpt_length( $length ) {
return 10;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );
@version-control
version-control / WP_Dev_Plugins.html
Created December 17, 2017 14:34
WP Plugins Developer List
Advanced Code Editor
Deactivate
Enables syntax highlighting in the integrated themes and plugins source code editors with line numbers, AutoComplete and much more. Supports PHP, HTML, CSS and JS.
Version 2.2.7 | By BaInternet | View details | Other Plugins by this author | Plugin Support | Donate
Select Advanced Random Posts Widget
Advanced Random Posts Widget
Deactivate
Easily to display advanced random posts via shortcode or widget.
@version-control
version-control / gist:3f7fab5279ff5caf43b3c56c3606048d
Created December 17, 2017 16:09
WP Index Include Comments in Loop
<?php
echo '<h6><p>';
//Gather comments for a specific page/post
$comments = get_comments(array(
'post_id' => $post->ID,
'status' => 'approve'
));
wp_list_comments(array(
@version-control
version-control / gist:a0788ae8b3a7b7a7b00f68753100c58f
Last active December 17, 2017 16:13
WP Index Display Number of Comments
<!-- Display Number of Comment -->
<?php
$args = array(
'post_id' => $post->ID, // use post_id, not post_ID
'count' => true //return only the count
);
$comments = get_comments($args);
echo '<h4>REVIEW COUNT = '.$comments.'</h4>'
?>
ACL Plugin does not have retrospective renaming of fields within the system. Pretty pointless in my eyes but if you do install ACL and then decide to rename the fields then use the database.
Below is from the owner on the forum.
------------------------------------------
The best way is to edit the field and change the field name. Next, access your DB via phpMyAdmin and write some SQL to look for the old field_name and replace it with the new field_name.
The field name will bi found multiple times in the wp_postmeta table in the meta_name column.
@version-control
version-control / nginx.conf
Created December 26, 2017 08:37 — forked from spikegrobstein/nginx.conf
nginx config for proxying requests for plex over a hostname-based virtualhost.
upstream plex-upstream {
# change plex-server.example.com:32400 to the hostname:port of your plex server.
# this can be "localhost:32400", for instance, if Plex is running on the same server as nginx.
server plex-server.example.com:32400;
}
server {
listen 80;
# server names for this server.
<nav id="site-navigation" class="main-navigation">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Primary Menu', 'feel-the-energy' ); ?></button>
<?php
wp_nav_menu( array(
'theme_location' => 'menu-1',
'menu_id' => 'primary-menu',
) );
?>
</nav><!-- #site-navigation -->
The Ports Collection is a set of Makefile, patches, and description files stored in /usr/ports. This set of files is used for building and installing applications on FreeBSD, and other BSD-based operating systems.
This post will describe how to use portmaster, a utility for updating installed ports. portmaster is nothing more than a shell script (albeit a quite elegant and powerful one), written in /bin/sh. It does not depend upon other ports, external databases or languages, rather it’s been written in such a way as to make use of the information about a port’s dependencies, dependents, file locations and other information contained in /var/db/pkg to determine which ports to update.
The versions of software discussed in this post are as follows:
FreeBSD 11.0-RELEASE
portmaster-3.17.10
Okay, let’s get started. All commands are issued as the root user or by simulating the root user by using the command su. Let’s make sure that the Ports Collection is updated to its most current version with the following co