This file contains 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
add_action('admin_enqueue_scripts', function () { | |
wp_enqueue_script('feedbackbird-app-script', 'https://cdn.jsdelivr.net/gh/feedbackbird/assets@master/wp/app.js?uid=YOUR_UID'); | |
wp_add_inline_script('feedbackbird-app-script', sprintf('var feedbackBirdObject = %s;', json_encode([ | |
'user_email' => function_exists('wp_get_current_user') ? wp_get_current_user()->user_email : '', | |
'platform' => 'wordpress-admin', | |
'meta' => [ | |
'php_version' => PHP_VERSION, | |
'active_plugins' => array_map(function ($plugin, $pluginPath) { | |
return [ | |
'name' => $plugin['Name'], |
This file contains 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 | |
/** | |
* Order Command | |
*/ | |
class OrderCommand | |
{ | |
/** | |
* Regenerate order downloads. | |
* |
This file contains 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
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
This file contains 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
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |
SET AUTOCOMMIT = 0; | |
START TRANSACTION; | |
SET time_zone = "+00:00"; | |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |
/*!40101 SET NAMES utf8mb4 */; |
This file contains 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; | |
} |
This file contains 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 <mostafa.soufi@hotmail.com> | |
*/ | |
add_filter( 'upload_dir', function($args) { | |
if( !isset($_REQUEST['post_id']) ) { | |
return $args; | |
} |
This file contains 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 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 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 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 | |
*/ |
NewerOlder