Skip to content

Instantly share code, notes, and snippets.

@orhant
orhant / wp-list-table.php
Created June 6, 2021 15:15 — forked from fieldoffice/wp-list-table.php
WordPress Admin Screen using WP_List_Table
<?php
if(is_admin()) { new wp_topups(); }
class wp_topups {
public function __construct() {
add_action( 'admin_menu', array($this, 'add_menu_example_list_table_page' ));
}
public function add_menu_example_list_table_page() {
add_menu_page( 'Account Top Ups', 'Account Top Ups', 'manage_options', basename(__FILE__), array($this, 'list_table_page'), 'dashicons-chart-bar', '4' );
}
@orhant
orhant / add-span-to-count.php
Created February 8, 2021 05:52 — forked from sarahmonster/add-span-to-count.php
Adds a span around post counts in category archives widget and general archives widgets. This allows for easy styling of the count—for instance, using leading dots. (The SCSS file adds leading dots.)
/**
* Filter the categories archive widget to add a span around post count
*/
function smittenkitchen_cat_count_span( $links ) {
$links = str_replace( '</a> (', '</a><span class="post-count">(', $links );
$links = str_replace( ')', ')</span>', $links );
return $links;
}
add_filter( 'wp_list_categories', 'smittenkitchen_cat_count_span' );
@orhant
orhant / meta-tags.md
Created June 18, 2020 13:04 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
# I know it's an ugly, but it works for me. Complete installation process:
sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get update;
sudo apt-get install -y python-software-properties python g++ make;
### 'add-apt-repository' not available on my Ubuntu 12.10 by default, so the next line adds it.
### more info found here: http://stackoverflow.com/questions/13018626/add-apt-repository-not-found
sudo apt-get install software-properties-common -y;
###
<?php
$compiler = new \Phalcon\Mvc\View\Engine\Volt\Compiler();
$compiler->addFunction('not_empty', '!empty');
echo highlight_string($compiler->compileString('
{% if not_empty(userinfo.vk) %}
<a id="vk" href="{{ userinfo.vk }}">vk</a>
@orhant
orhant / phalcon-models.php
Created March 4, 2020 16:00 — forked from xboston/phalcon-models.php
Phalcon model public/protected var's test
<?php
use Phalcon\DI , Phalcon\Db\Adapter\Pdo\Mysql as Connection , Phalcon\Mvc\Model\Manager as ModelsManager , Phalcon\Mvc\Model\Metadata\Memory as MetaData , Phalcon\Mvc\Model;
$di = new DI();
//Setup a connection
$di->set(
'db' ,
new Connection(array(
@orhant
orhant / phalcon volt addFilter addFunction.php
Created March 4, 2020 16:00 — forked from xboston/phalcon volt addFilter addFunction.php
Phalcon volt - addFunction vs addFilter
<?php
$compiler = new \Phalcon\Mvc\View\Engine\Volt\Compiler();
$compiler->addFunction("test1", function($resolvedArgs, $exprArgs) {
$value = $exprArgs[0]['expr']['value'];
return str_replace('$', '&euro;', $value);
});
@orhant
orhant / Timestampable.php
Created March 4, 2020 15:59 — forked from xboston/Timestampable.php
phalcon timestampable trait
<?php
namespace ShareModels\Traits {
use Phalcon\Mvc\Model\Behavior\Timestampable as TimestampableBehavior;
/**
* Class Timestampable
*
* @method addBehavior
@orhant
orhant / wingets.php
Created March 4, 2020 15:58 — forked from xboston/wingets.php
Phalcon wingets
<?php
/**
Регистрация сервиса представлений
$di['widgetRender'] = function () use ($di) {
$view = new Phalcon\Mvc\View\Simple();
$view->setViewsDir(APPLICATION_ROOT . '/Views/Widgets/');
@orhant
orhant / MenuWinget.php
Created March 4, 2020 15:57 — forked from xboston/MenuWinget.php
MenuWinget.php
<?php
namespace Widgets {
use Mytutcodim\Mvc\View\Widget;
/**
* Class Menu
*
* @package Widget