This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Upload custom post type files in another folder | |
* @author Mostafa soufi <[email protected]> | |
*/ | |
add_filter( 'upload_dir', function($args) { | |
if( !isset($_REQUEST['post_id']) ) { | |
return $args; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo wp_statistics_pages($post->ID); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="post" action=""> | |
<label> | |
Destination number: | |
<input type="text" value="" name="number" required> | |
</label> | |
<label> | |
Text: | |
<textarea name="message" required></textarea> | |
</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Service_Checker | |
* @author Mostafa Soufi | |
*/ | |
class Service_Checker { | |
/** | |
* @var array | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get Next & Previous post | |
* | |
* @param $post_id | |
* @param $category_id | |
* @param string $taxonomy | |
* | |
* @return array | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RED='\033[0;31m' | |
NC='\033[0m' | |
array=( | |
"project-name1" | |
"project-name2" | |
) | |
for i in ${array[*]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// TASK 1 - print out your name with one of php loops | |
foreach (str_split('Mostafa') as $char) { | |
echo $char; | |
} |