Skip to content

Instantly share code, notes, and snippets.

@brentini
brentini / blank-template-snippets.txt
Created July 1, 2012 23:03 — forked from cod3cow/template-snippets.txt
Blank Template Snippets for Joomla! 2.5 - http://blank.vc
# all php files :: disallow direct access of file
# between <?php and ?>
defined('_JEXEC') or die;
# index.php :: define variable with application
# between <?php and ?>
$app = JFactory::getApplication();
# index.php :: define variable with document
# between <?php and ?>
@brentini
brentini / class-walker-navbar-menu.php
Last active March 23, 2018 21:32
Walker class for WordPress custom menu integration in Twitter Bootstrap navbar #wordpress
<?php
class Walker_Navbar_Menu extends Walker_Nav_Menu {
public $dropdown_enqueued;
function __construct() {
$this->dropdown_enqueued = wp_script_is( 'bootstrap-dropdown', 'queue' );
}
@brentini
brentini / symlink-joomla
Created August 2, 2012 18:59 — forked from wizmedia/symlink-joomla
This script allows you to deploy multiple installations of Joomla! using one Joomla! full source directory. Can be very useful for Multiple websites using only one main Joomla! Directory.
@brentini
brentini / gist:3240230
Created August 2, 2012 20:09
CSS: Min-height fast hack
selector {
min-height:500px;
height:auto !important;
height:500px;
}
@brentini
brentini / gist:3240578
Created August 2, 2012 20:56
Joomla: first and last menu item classes
<?php
$last_level_one_id = 0;
for($j=count($list)-1; $j>0; $j—){
if($list[$j]->level == 1){
$last_level_one_id = $list[$j]->id;
break;
}
} $first_start = true;
?>
Then we find the code below, this is the bit that adds classes to the menu elements and modify as shown below:
@brentini
brentini / gist:3363239
Created August 15, 2012 20:18
Wordpress: Add pdf support to media manager
function modify_post_mime_types( $post_mime_types ) {
// select the mime type, here: 'application/pdf'
// then we define an array with the label values
$post_mime_types['application/pdf'] = array( __( 'PDFs' ), __( 'Manage PDFs' ), _n_noop( 'PDF <span class="count">(%s)</span>', 'PDFs <span class="count">(%s)</span>' ) );
// then we return the $post_mime_types variable
return $post_mime_types;
@brentini
brentini / gist:3363471
Created August 15, 2012 20:43
WordPress: Remove Admin Bar from Front End Site
//Completely Removes Admin Bar from Front End Site
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); // For front end
// CSS override for the frontend
function remove_admin_bar_style_frontend() {
echo '';
}
add_filter('wp_head','remove_admin_bar_style_frontend', 99);
@brentini
brentini / WordPress Better login url
Created August 15, 2012 21:07
Wordpress: Better login url
RewriteRule ^login$ http://website.com/wp-login.php [NC,L]
@brentini
brentini / gist:3363710
Created August 15, 2012 21:11
WordPress: show the comments to the authors own posts
function wps_get_comment_list_by_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses['join'] = ", wp_posts";
$clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID";
};
return $clauses;
};
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'wps_get_comment_list_by_user');
@brentini
brentini / blank-template-snippets.txt
Created August 20, 2012 17:59 — forked from cod3cow/template-snippets.txt
Blank Template Snippets for Joomla! 2.5 - http://blank.vc
# all php files :: disallow direct access of file
# between <?php and ?>
defined('_JEXEC') or die;
# index.php :: define variable with application
# between <?php and ?>
$app = JFactory::getApplication();
# index.php :: define variable with document
# between <?php and ?>