wordpress contect form 7 select option and plugin

0
255

<?php
/*
Template Name: My Test Page
*/

get_header();
echo types_render_field(‘image’, array());

$my_postid = get_the_ID();
$content_post = get_post($my_postid);
$content = $content_post->post_content;

echo $content;

get_footer();

//Types plugin
global $post;

$post = get_post($post_id);
//echo types_render_field(‘upload-image’, array(“index” => 0));
echo types_render_field(‘mobile’, array());

//////Contact form7
add_filter(‘screen_settings’, ‘screen_options_demo’, 10,2);
function screen_options_demo($current, $screen){
$current .= “Hello WordPress!”.$_GET[‘post_type’];

return $current;
}

function my_wpcf7_form_elements($html) {
$text = ‘Please select…’;
$html = str_replace(‘<option value=””>—</option>’, ‘<option value=””>’ . $text . ‘</option>’, $html);
return $html;
}
add_filter(‘wpcf7_form_elements’, ‘my_wpcf7_form_elements’);

function my_wpcf7_form_elements($html) {
function ov3rfly_replace_include_blank($name, $text, &$html) {
$matches = false;
preg_match(‘/<select name=”‘ . $name . ‘”[^>]*>(.*)<\/select>/iU’, $html, $matches);
if ($matches) {
$select = str_replace(‘<option value=””>—</option>’, ‘<option value=””>’ . $text . ‘</option>’, $matches[0]);
$html = preg_replace(‘/<select name=”‘ . $name . ‘”[^>]*>(.*)<\/select>/iU’, $select, $html);
}
}
ov3rfly_replace_include_blank(‘menu-569’, ‘Choose language’, $html);
ov3rfly_replace_include_blank(‘menu-614’, ‘Choose country’, $html);
return $html;
}
add_filter(‘wpcf7_form_elements’, ‘my_wpcf7_form_elements’);

/////////////////////////////plugin code ///////////////////////////////////

<?php
/**
* Plugin Name: Welcome
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the plugin.
* Version: The plugin’s version number. Example: 1.0.0
* Author: Name of the plugin author
* Author URI: http://URI_Of_The_Plugin_Author
* Text Domain: Optional. Plugin’s text domain for localization. Example: mytextdomain
* Domain Path: Optional. Plugin’s relative directory path to .mo files. Example: /locale/
* Network: Optional. Whether the plugin can only be activated network wide. Example: true
* License: A short license name. Example: GPL2
*/

class Welcome{

private static $initiated = false;

public static function init() {
if ( ! self::$initiated ) {
self::init_hooks();
}
}

private static function init_hooks() {
self::$initiated = true;
add_action(‘admin_menu’, array(‘Welcome’,’welcome_menu’) );

add_action(‘save_post’, array(‘Welcome’,’welcome_post’) );

}

public static function welcome_post()
{
//die(‘This is just post edit test’);
}

//add welcome menu to settings
public static function welcome_menu() {
add_options_page(‘Welcome Menu Page’, ‘Welcome’, ‘read’, ‘welcome’, array(‘Welcome’,’welcome_function’) );
}

public static function welcome_function()
{
echo ‘<h1>This is post test page</h1>’;
}

function bot_install()
{

die(‘DDDDDDDDDDDd’);
global $wpdb;
$table = $wpdb->prefix.”bot_counter”;
$structure = “CREATE TABLE $table (
id INT(9) NOT NULL AUTO_INCREMENT,
bot_name VARCHAR(80) NOT NULL,
bot_mark VARCHAR(20) NOT NULL,
bot_visits INT(9) DEFAULT 0,
UNIQUE KEY id (id)
);”;
$wpdb->query($structure);

// Populate table
$wpdb->query(“INSERT INTO $table(bot_name, bot_mark)
VALUES(‘Google Bot’, ‘googlebot’)”);
$wpdb->query(“INSERT INTO $table(bot_name, bot_mark)
VALUES(‘Yahoo Slurp’, ‘yahoo’)”);
}

}

add_action( ‘init’, array( ‘Welcome’, ‘init’ ) );
add_filter(‘wp_title’,  ‘charLimit’ );

function charLimit( $limit ) {
return ‘<h1>DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</h1>’;
}

add_action(‘activate_bot/bots.php’, ‘bot_install’);

register_activation_hook( __FILE__,  array(‘Welcome’, ‘bot_install’) );

///////////short code

function footag_func( $atts ) {
return “foo = {$atts[‘foo’]}”;
}
add_shortcode( ‘hello’, ‘footag_func’ );

function bartag_func( $atts ) {
$atts = shortcode_atts( array(
‘foo’ => ‘no foo’,
‘baz’ => ‘default baz’
), $atts, ‘bartag’ );

return “foo = {$atts[‘foo’]}”;
}
add_shortcode( ‘bartag’, ‘bartag_func’ );

function baztag_func( $atts, $content = “” ) {
return “content = $content”;
}
add_shortcode( ‘baztag’, ‘baztag_func’ );
//[baztag]content[/baztag] ?>