Skip to content

Instantly share code, notes, and snippets.

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

LAI HOP HIEP laihophiep

🏠
Working from home
View GitHub Profile
// Add term page
function custom_url_taxonomy_add_new_meta_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="term_meta[custom_term_meta]"><?php _e( 'Custom url category', 'custom_url_category' ); ?></label>
<input type="text" name="term_meta[custom_term_meta]" id="term_meta[custom_term_meta]" value="">
<p class="description"><?php _e( 'Inserisci un custom url prodotto per la categoria','custom_url_category' ); ?></p>
</div>
<?php
@laihophiep
laihophiep / user-meta-upload.php
Created November 10, 2022 16:46 — forked from bainternet/user-meta-upload.php
User Meta Upload
<?php
/*
Plugin Name: User Meta Upload
Plugin URI: http://trepmal.com
Description: Add a file-upload form to the user edit profile page
Version: 0.1
Author: Kailey Lampert
Author URI: http://kaileylampert.com
Copyright (C) 2012 Kailey Lampert
@laihophiep
laihophiep / wp-registration-keys.php
Created November 10, 2022 16:44 — forked from bainternet/wp-registration-keys.php
Only lets users with an invite code register for a WordPress site.
<?php
/*
Plugin Name: WP Invite Codes
Plugin URI: http://pmg.co/
Description: Makes wordpress an invite only community.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@laihophiep
laihophiep / bitbucket-api.php
Created November 10, 2022 16:42 — forked from bainternet/bitbucket-api.php
create bitbucket issue php api
<?php
/* Function submitBug - sends the bug to the bitbucket API. Must contain title and content. User name/email is optional.*/
function submitBug($title, $content, $user='Anonymous', $bbAccount, $bbRepo, $basicAuth, $component='', $status='new', $priority='major', $kind='bug'){
$url = 'https://api.bitbucket.org/1.0/repositories/'.$bbAccount.'/'.$bbRepo.'/issues/';
$ch = curl_init($url);
if (get_magic_quotes_gpc()) {
$title = stripslashes($title);
$content = stripslashes($content);
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@laihophiep
laihophiep / functions.php
Created August 30, 2022 15:59 — forked from taniarascia/functions.php
Inlcuding custom fields and uploads in a WordPress post
<?php
function create_post_your_post() {
register_post_type( 'your_post',
array(
'labels' => array(
'name' => __( 'Your Post' ),
),
'public' => true,
'hierarchical' => true,
@laihophiep
laihophiep / fruity-fruit.php
Created July 13, 2022 17:02 — forked from justintadlock/fruity-fruit.php
Saving multiple meta values for a single key with a meta box.
<?php
/*
Plugin Name: Fruity Fruit
Description: An example plugin to test saving multiple meta values.
*/
add_action( 'add_meta_boxes_post', 'fruity_fruit_add_meta_boxes' );
add_action( 'save_post', 'fruity_fruit_save_meta', 10, 2 );
function fruity_fruit_add_meta_boxes() {
@laihophiep
laihophiep / class.php
Created June 6, 2022 07:46 — forked from hlashbrooke/class.php
A complete, versatile options page class for any WordPress plugin
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class WordPress_Plugin_Template_Settings {
private $dir;
private $file;
private $assets_dir;
private $assets_url;
private $settings_base;
@laihophiep
laihophiep / cf7.css
Created November 29, 2021 04:32 — forked from codehandling/cf7.css
Contact Form 7 Styles
/***********basic************/
/*Form width*/
.wpcf7 {
text-align: left;
width: 40%;
}
/*Input Field widths*/
.wpcf7-text, .wpcf7-textarea {
<?php
// Version CSS file in a theme
wp_enqueue_style( 'theme-styles', get_stylesheet_directory_uri() . '/style.css', array(), filemtime( get_stylesheet_directory() . '/style.css' ) );
// Version JS file in a theme
wp_enqueue_script( 'theme-scripts', get_stylesheet_directory_uri() . '/js/scripts.js', array(), filemtime( get_stylesheet_directory() . '/js/scripts.js' ) );