Skip to content

Instantly share code, notes, and snippets.

@dionysia
dionysia / PiwigoHorizontalThumbs.css
Created February 7, 2019 22:19
Horizontal thumbnail styling for Piwigo CSS
/* source -- https://wordpress.org/plugins/piwigopress/#faq */
.PiwigoPress_photoblog {
display:inline-block;
}
.PWGP_shortcode {
display:inline-block;
}
@dionysia
dionysia / WP_remove_from_plugin_list
Created October 14, 2013 07:26
Here is a WordPress snippet that will allow you to install the plugin and once it is activated it will be removed from the plugin screen so it can not be deactivated. The plugin will still be active and can be used as normal but it means that users can not deactivate these plugins. You can add the following into the theme functions.php file or c…
<?php
add_filter( 'all_plugins', 'hide_plugins');
function hide_plugins($plugins)
{
// Hide hello dolly plugin
if(is_plugin_active('hello.php')) {
unset( $plugins['hello.php'] );
}
// Hide disqus plugin
@dionysia
dionysia / WP_hide_update_notice
Created October 14, 2013 07:22
Use the following code to hide the update message to all users except Admin users. From Paulund's blog: http://www.paulund.co.uk/hide-wordpress-update-notice
function hide_update_notice_to_all_but_admin_users()
{
if (!current_user_can('update_core')) {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action( 'admin_notices', 'hide_update_notice_to_all_but_admin_users', 1 );
add_filter('the_content_feed', 'rss_post_thumbnail');
function rss_post_thumbnail($content) {
global $post;
if( has_post_thumbnail($post->ID) )
$content = '<p>' . get_the_post_thumbnail($post->ID, 'thumbnail') . '</p>' . $content;
return $content;
}
@dionysia
dionysia / CSS-3D-X-wing.markdown
Created August 30, 2013 01:26
A Pen by Julian Garnier.
@dionysia
dionysia / WP_add_feed()
Last active December 19, 2015 18:19
From Steve Zehngut http://zeek.com/add_feed/
<!-- I discussed this function during the lightning round at WordCamp San Diego 2013.
add_feed() adds a custom feed to your WordPress site. I discovered this function recently when I needed to create a feed that
uses a custom query. Specifically, a client needed a feed that pulled together content in a single category from multiple
custom post types. The default WordPress category feeds will not pull content from multiple custom post types. The code below
can be dropped into functions.php in your theme folder or it could be rolled into a plugin. -->
add_feed( 'games' , 'make_games_feed' );
function make_games_feed(){
$args = array(
@dionysia
dionysia / WP_setCHMOD
Created July 11, 2013 00:51
If you've ever run into the problem of being asked for FTP everytime you want to upload or install something and you're sick and tired of always running chown or changing permissions, this fix to your wp-config.php will help everytime to ensure your php user can handle all of this stuff... From Michael Cabral Poubel Bastos, Advanced Wordpress on FB
<!-- add tp wp-config.php -->
define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', 0755 );
define( 'FS_CHMOD_FILE', 0755 );
@dionysia
dionysia / WP_autoaddparagraphanchor
Created March 9, 2013 21:50
From WP StackExchange: http://wordpress.stackexchange.com/questions/90066/numbering-sections-and-block-level-elements-in-wpautop-wordpress-as-cms-for-l I am starting to learn how to write plugins for Wordpress. I'm interested in using WP as a CMS for long essays (6000-9000 words or more). My problem is what I call the Kindle problem, which is ho…
class InsertAnchors {
protected $count = 0;
protected $links = '';
public function build( $pattern, $content ) {
$this->count = 0;
$this->links = '';
$content = preg_replace_callback( $pattern, array( $this, '_replacer' ), $content );
return '<p>' . $this->links . '</p>' . $content;
}
public function _replacer( $matches ) {
@dionysia
dionysia / WPchildpageLinks
Created February 24, 2013 07:12
Get Wordpress child pages of current page and echo them as links
@dionysia
dionysia / HighlightCurrentPageWPnav
Created February 11, 2013 09:57
To highlight current page in WP navigation menu
1. In css file,include this line where
- nav is the id of <nav> tag, [mentioned my menus in header.php]
<nav id="nav">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav>
#nav li.current_page_item a {
-moz-border-radius: 3px 3px 3px 3px;