tsg1957
Forum Replies Created
-
Forum: Plugins
In reply to: Need help desparate!okay, so after installing them and activating them from the dashboard, I must also transfer portions of the code <tags> in to the template css. am I getting this right?
So I must remove // from the functions of my choice, i am including an example, I had barely gotten a handle on xhtml and this php is very new to me! Thank you to who ever helps here, it is appreciated!
<?php
/*
Plugin Name: Google Search widget
Description: Adds a sidebar widget to let users search your site with Google.
Author: Automattic, Inc.
Version: 1.0
Author URI: https://automattic.com
*/// Put functions into one big function we’ll call at the plugins_loaded
// action. This ensures that all required plugin functions are defined.
function widget_gsearch_init() {// Check for the required plugin functions. This will prevent fatal
// errors occurring when you deactivate the dynamic-sidebar plugin.
if ( !function_exists(‘register_sidebar_widget’) )
return;// This is the function that outputs our little Google search form.
function widget_gsearch($args) {// $args is an array of strings that help widgets to conform to
// the active theme: before_widget, before_title, after_widget,
// and after_title are the array keys. Default tags: li and h2.
extract($args);// Each widget can store its own options. We keep strings here.
$options = get_option(‘widget_gsearch’);
$title = $options[‘title’];
$buttontext = $options[‘buttontext’];// These lines generate our output. Widgets can be very complex
// but as you can see here, they can also be very, very simple.
echo $before_widget . $before_title . $title . $after_title;
$url_parts = parse_url(get_bloginfo(‘home’));
echo ‘<div style=”margin-top:5px;text-align:center;”><form id=”gsearch” action=”https://www.google.com/search” method=”get” onsubmit=”this.q.value=\’site:’.$url_parts[‘host’].’ \’+this.rawq.value”><input name=”rawq” size=”20″ /><input type=”hidden” name=”q” value=”” /><input value=”‘.$buttontext.'” name=”submit” type=”submit” /></form></div>’;
echo $after_widget;
}// This is the function that outputs the form to let the users edit
// the widget’s title. It’s an optional feature that users cry for.
function widget_gsearch_control() {// Get our options and see if we’re handling a form submission.
$options = get_option(‘widget_gsearch’);
if ( !is_array($options) )
$options = array(‘title’=>”, ‘buttontext’=>__(‘Google Search’, ‘widgets’));
if ( $_POST[‘gsearch-submit’] ) {// Remember to sanitize and format use input appropriately.
$options[‘title’] = strip_tags(stripslashes($_POST[‘gsearch-title’]));
$options[‘buttontext’] = strip_tags(stripslashes($_POST[‘gsearch-buttontext’]));
update_option(‘widget_gsearch’, $options);
}// Be sure you format your options to be valid HTML attributes.
$title = htmlspecialchars($options[‘title’], ENT_QUOTES);
$buttontext = htmlspecialchars($options[‘buttontext’], ENT_QUOTES);// Here is our little form segment. Notice that we don’t need a
// complete form. This will be embedded into the existing form.
echo ‘<p style=”text-align:right;”><label for=”gsearch-title”>’ . __(‘Title:’) . ‘ <input style=”width: 200px;” id=”gsearch-title” name=”gsearch-title” type=”text” value=”‘.$title.'” /></label></p>’;
echo ‘<p style=”text-align:right;”><label for=”gsearch-buttontext”>’ . __(‘Button Text:’, ‘widgets’) . ‘ <input style=”width: 200px;” id=”gsearch-buttontext” name=”gsearch-buttontext” type=”text” value=”‘.$buttontext.'” /></label></p>’;
echo ‘<input type=”hidden” id=”gsearch-submit” name=”gsearch-submit” value=”1″ />’;
}// This registers our widget so it appears with the other available
// widgets and can be dragged and dropped into any active sidebars.
register_sidebar_widget(array(‘Google Search’, ‘widgets’), ‘widget_gsearch’);// This registers our optional widget control form. Because of this
// our widget will have a button that reveals a 300×100 pixel form.
register_widget_control(array(‘Google Search’, ‘widgets’), ‘widget_gsearch_control’, 300, 100);
}Forum: Installing WordPress
In reply to: Can advertising be implemented into wordpress blog site?Caveat: that’s IF you’re downloading the distro from the link at the top of the page and installing the blog on a domain name of your own under your own hosting account. If you’re wanting to use a wordpress.com hosted blog, no, you can’t generally use ads on one of those.
Yes my domain, and my own hosting, thanks, that’s where I must have seen the info saying no monetizing using built in blog!
you guys are great!
Forum: Installing WordPress
In reply to: Can advertising be implemented into wordpress blog site?I don’t mean to sound thick here, and maybe I didn’t word this well, I guess I am asking, as far as licensing is concerned, seeing how I d/l’d it for free, from someone else’s hard work, and then I am going to make money on it, is this acceptable, or is there other license options I didn’t see, while reading some of the documentation, I thought I saw something (couldn’t find it again)that this was free to use as long as you don’t make money from it, I just do not want to infringe on anyone’s intellectual property!
Thanks for the responses so far,
TSG!
Forum: Installing WordPress
In reply to: Can advertising be implemented into wordpress blog site?Not sure what you mean, what I want to do is write quality articles on specific subjects, and if through some signature links, and other means of attracting traffic, I can generate some income, for some reason this is not right? I am very new at this, so patience please ??