Skip to content

Instantly share code, notes, and snippets.

View ertankayalar's full-sized avatar
🏠
Working from home

Ertan Kayalar ertankayalar

🏠
Working from home
View GitHub Profile
div.post-content { display:none; } a.continue-button { color: white; }
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; //this line only needed for pagination
$args = array(
'cat' => 7,
'paged' => $paged //this line only needed for pagination
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
<?php
/*
INSTRUCTIONS:
Use at your own risk. Backup your database before continuing.
1. Copy code to a file in the root of your website.
2. Change YOUR_SITE_ROOT to a value that makes sense.
3. Execute by visiting the page. Verify before/after results.
4. Change MAKE_CHANGES_TO_SITE to true and execute it again.
<?php
/**
* Ban/Limit Email Domains for Gravity Form Email Fields
* http://gravitywiz.com/2012/11/11/banlimit-email-domains-for-gravity-form-email-fields/
*/
class GWEmailDomainControl {
private $_args;
function __construct($args) {
@ertankayalar
ertankayalar / yii-get-user-ip-address.php
Created June 22, 2013 14:09
yii get user ip address
<?php
$newOrder->ip = Yii::app()->request->userHostAddress;
<?php
$this->render('//site/error', array('message' => 'hata mesajı', 'code' => '123'));
@ertankayalar
ertankayalar / Yii-CActiveDataProvider.php
Created June 22, 2013 14:07
yii active data provider
<?php
$dataProvider=new CActiveDataProvider('Post', array(
'criteria'=>array(
'condition'=>'status=1',
'order'=>'create_time DESC',
'with'=>array('author'),
),
'pagination'=>array(
'pageSize'=>20,
),
@ertankayalar
ertankayalar / yii-breadcrumbs-menu.php
Created June 22, 2013 14:06
yii breadcrumbs menu
<?php
$this->breadcrumbs=array(
Yii::t('holiday', 'Adverts'),
);
veya
$this->breadcrumbs=array(
'Menu Items'=>array('index'),
'Create',
);
@ertankayalar
ertankayalar / doctrine-guide.php
Created June 22, 2013 14:05
doctrine notları
<?php
/*
doctrine ile kodlama yaparken mümkün oldukça array olarak döndürelim
---------------------------------------------------------------------
*/
public function getUserId($username) {
$user = Doctrine_Query::create()
->select('u.id, u.user_name')
->from('User u')
@ertankayalar
ertankayalar / start and end dates of the week.php
Created June 22, 2013 14:03
start and end dates of week
<?php
// calculate start and end dates of the week
// 0 = Sunday
echo date("Y-m-d", strtotime(date("Y").'W'.date('W')."0"));
// 7 = Saturday
echo date("Y-m-d", strtotime(date("Y").'W'.date('W')."7"));