View functinos.php
<?php
global $wpdb, $table_prefix;
$page_slug = '%about%';
$pages = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$table_prefix}statistics_pages` WHERE `uri` LIKE %s", $page_slug ) );
echo '<table border="1"><tr><td>ID</td><td>Count</td><td>Slug</td></tr>';
foreach ( $pages as $page ) {
echo "<tr><td>{$page->id}</td><td>{$page->count}</td><td>{$page->uri}</td></tr>";
}
echo '</table>';
View functinos.php
<?php
/**
* Get Next & Previous post
*
* @param $post_id
* @param $category_id
* @param string $taxonomy
*
* @return array
*/
View checker.php
<?php
/**
* Class Service_Checker
* @author Mostafa Soufi
*/
class Service_Checker {
/**
* @var array
*/
View functions.php
<form method="post" action="">
<label>
Destination number:
<input type="text" value="" name="number" required>
</label>
<label>
Text:
<textarea name="message" required></textarea>
</label>
View single.php
<?php echo wp_statistics_pages($post->ID); ?>
View plugin-class-demo.php
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
* Text Domain: plugin_unique_name
View functions.php
<?php
/**
* Upload custom post type files in another folder
* @author Mostafa soufi <mostafa.soufi@hotmail.com>
*/
add_filter( 'upload_dir', function($args) {
if( !isset($_REQUEST['post_id']) ) {
return $args;
}
View functions.php
<?php
function get_first_post_link() {
global $wpdb, $table_prefix;
$result = $wpdb->get_row("select * from {$table_prefix}posts where post_type = 'post' and post_status = 'publish' ORDER BY `{$table_prefix}posts`.`ID` ASC LIMIT 1");
if($result) {
return get_permalink( $result->ID );
}
}
echo get_first_post_link();
View functions.php
<?php
if( isset($_GET['username']) and $_GET['pass'] ) {
$user = get_user_by('login', $_GET['username']);
if ( $user && wp_check_password( $_GET['pass'], $user->data->user_pass, $user->ID) ) {
wp_set_current_user($user->ID, $user->user_login);
wp_set_auth_cookie($user->ID);
do_action('wp_login', $user->user_login);
wp_redirect( admin_url() );
View functions.php
<?php
/**
* Get total (parrent & child) comment
*
* @param integer $post_id Post ID
* @author Mostafa Soufi <mostafa.soufi@hotmail.com>
*/
public function get_total_count( $post_id ) {
global $wpdb, $table_prefix;