Skip to content

Instantly share code, notes, and snippets.

View proweb's full-sized avatar

Sergey Mochalov proweb

View GitHub Profile
@proweb
proweb / functions.php
Last active May 7, 2017 03:35
Wordpress. Function for remove archive prefix from archive title. Remove “Category:”, “Tag:”, “Author:” from the_archive_title.
function remove_category_prefix_from_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
@proweb
proweb / json.php
Created August 14, 2013 07:50
Best way for JSON output in Joomla controller
class MyController extends JController
{
function someTask()
{
// Get the application object.
$app = JFactory::getApplication();
// Get the model.
$model = $this->getModel('MyModel');
@proweb
proweb / index.php
Created June 16, 2013 17:31
Easy PHP localhost landing page
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>localhost</title>
</head>
<body>
<h1>It Works!</h1>
<ul>
<?php
@proweb
proweb / router.php
Created February 2, 2013 08:58
K2 Router (without "item" in URL)
<?php
/**
* @version $Id: router.php 1618 2012-09-21 11:23:08Z lefteris.kavadas $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2012 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
@proweb
proweb / index.php
Created January 25, 2013 14:00
HTML 5 Joomla head override - Переписываем вывод HEAD для Joomla 2.5 в соответствии со стандартами HTML5
<?php
// no direct access
defined('_JEXEC') or die;
// Variables
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$template = 'templates/' . $this->template;
// get html head data