Adding new Service boxes to Blogs MU and…

1. I see there’s an option to add 3 sections to the home page. In this area I see that you’re also able to add “widgets”. Right now I’m trying to add 3 images but I don’t want the Title of the section to appear, only the image will appear in that section box. If I’m unable to remove the title how would I go about adding a “Text widget” in each of those section boxes?

2. I’m trying to add an additional 3 service boxes taking my total up to 9. Each box will link to one of the nine (9) networks I have in this community. What I can’t figure out is how to make the options appear in the admin section. So far I’ve made the following changes:

1a. Service-mode.php – Locate the following code:

<div class=”sbox”>

<div class=”simg”>

<div class=”img-services”>

<?php if(file_exists($upload_path . ‘blogsmu1_normal.jpg’:wink:) { ?>

“><img src=”<?php echo “$ttpl_path/blogsmu1_normal.jpg”; ?>” alt=”<?php echo stripslashes($tn_blogsmu_headline1); ?>” />

<?php } elseif(file_exists($upload_path . ‘blogsmu1_thumb.jpg’:wink:) { ?>

“><img src=”<?php echo “$ttpl_path/blogsmu1_thumb.jpg”; ?>” alt=”<?php echo stripslashes($tn_blogsmu_headline1); ?>” />

<?php } else { ?>

<img src=”<?php echo get_template_directory_uri(); ?>/_inc/images/default.jpg” alt=”img” />

<?php } ?>

</div>

</div>

<h3><?php echo stripslashes($tn_blogsmu_headline1); ?></h3>

<p>

<?php if($tn_blogsmu_text1 == “”:wink:{ ?>

<?php _e(‘You can replace this area with a new text in your theme options and upload and crop new images to replace the image you can see here already.’, TEMPLATE_DOMAIN); ?>

<?php } else { ?>

<?php

$com_short = $tn_blogsmu_text1;

$chars = 200;

$com_short = $com_short . ” “;

$com_short = substr($com_short,0,$chars);

$com_short = substr($com_short,0,strrpos($com_short,’ ‘:wink:);

$com_short = $com_short . “…”;

?>

<?php

if( function_exists(‘do_shortcode’:wink: ) {

echo do_shortcode(stripslashes($com_short));

} else {

echo stripslashes($com_short);

}

?>

And replace all of the ones (1) with the new number, which in this case would be seven (7). So I end up with:

<div class=”sbox”>

<div class=”simg”>

<div class=”img-services”>

<?php if(file_exists($upload_path . ‘blogsmu7_normal.jpg’:wink:) { ?>

“><img src=”<?php echo “$ttpl_path/blogsmu7_normal.jpg”; ?>” alt=”<?php echo stripslashes($tn_blogsmu_headline7); ?>” />

<?php } elseif(file_exists($upload_path . ‘blogsmu7_thumb.jpg’:wink:) { ?>

“><img src=”<?php echo “$ttpl_path/blogsmu7_thumb.jpg”; ?>” alt=”<?php echo stripslashes($tn_blogsmu_headline7); ?>” />

<?php } else { ?>

<img src=”<?php echo get_template_directory_uri(); ?>/_inc/images/default.jpg” alt=”img” />

<?php } ?>

</div>

</div>

<h3><?php echo stripslashes($tn_blogsmu_headline7); ?></h3>

<p>

<?php if($tn_blogsmu_text7 == “”:wink:{ ?>

<?php _e(‘You can replace this area with a new text in your theme options and upload and crop new images to replace the image you can see here already.’, TEMPLATE_DOMAIN); ?>

<?php } else { ?>

<?php

$com_short = $tn_blogsmu_text7;

$chars = 200;

$com_short = $com_short . ” “;

$com_short = substr($com_short,0,$chars);

$com_short = substr($com_short,0,strrpos($com_short,’ ‘:wink:);

$com_short = $com_short . “…”;

?>

<?php

if( function_exists(‘do_shortcode’:wink: ) {

echo do_shortcode(stripslashes($com_short));

} else {

echo stripslashes($com_short);

}

?>

<?php } ?>

<span class=”learn-more”>“><?php _e(“Find out more”, TEMPLATE_DOMAIN); ?></span>

</p>

</div>

=========================================================

2a. Services-functions.php – So far I’ve modified the following items:

Locate the following:

$options9 = array (

array ( “name” => “Service headline 6”,

“id” => $shortname.”_blogsmu_headline6″,

“std” => “Service Headline 6”,

“type” => “text”:wink:,

array ( “name” => “Service 6 link *must have http://“,

“id” => $shortname.”_blogsmu_headline6_link”,

“std” => “”,

“type” => “text”:wink:,

array ( “name” => “Service short text 6”,

“id” => $shortname.”_blogsmu_text6″,

“std” => “”,

“type” => “textarea”:wink:

);

And change it to: Repeat for each service box.

$options10 = array (

array ( “name” => “Service headline 7”,

“id” => $shortname.”_blogsmu_headline7″,

“std” => “Service Headline 7”,

“type” => “text”:wink:,

array ( “name” => “Service 7 link *must have http://“,

“id” => $shortname.”_blogsmu_headline7_link”,

“std” => “”,

“type” => “text”:wink:,

array ( “name” => “Service short text 7”,

“id” => $shortname.”_blogsmu_text7″,

“std” => “”,

“type” => “textarea”:wink:

);

===================================================

Locate the following:

foreach ($options9 as $value){ delete_option( $value ); }

And change it to the following for each new service box:

foreach ($options10 as $value){ delete_option( $value ); }

===================================================

Locate the following:

if(file_exists($upload_path . $image_prefix_name . “6.jpg”:wink:) {

unlink(“$upload_path_check/” . $image_prefix_name . “6.jpg”:wink:;

unlink(“$upload_path_check/” . $image_prefix_name . “6_thumb.jpg”:wink:;

}

And change it to the following for each new service box:

if(file_exists($upload_path . $image_prefix_name . “7.jpg”:wink:) {

unlink(“$upload_path_check/” . $image_prefix_name . “7.jpg”:wink:;

unlink(“$upload_path_check/” . $image_prefix_name . “7_thumb.jpg”:wink:;

}

===================================================

I have this code but I’m not sure what to change:

<?php

echo “<div id=’tab5′ class=’tabc’>”;

$normal_image_name = $image_prefix_name . ‘5_normal.jpg’; // New name of the large image

$large_image_name = $image_prefix_name . ‘5.jpg’; // New name of the large image

$thumb_image_name = $image_prefix_name . ‘5_thumb.jpg’; // New name of the thumbnail image

$max_file = “1000000”; // Approx below 1MB

$max_width = “850”; // Max width allowed for the large image

$thumb_width = “260”; // Width of thumbnail image

$thumb_height = “150”; // Height of thumbnail image

//Image Locations

$normal_image_location = $upload_path.$normal_image_name;

$large_image_location = $upload_path . $large_image_name;

$thumb_image_location = $upload_path . $thumb_image_name;

//Check to see if any images with the same names already exist

if (file_exists($large_image_location)){

if (file_exists($thumb_image_location)){

$thumb_photo_exists = “<img src=””.$upload_path.$thumb_image_name.”” alt=”Thumbnail Image”/>”;

} else {

$thumb_photo_exists = “”;

}

$large_photo_exists = “<img src=””.$upload_path.$large_image_name.”” alt=”Large Image”/>”;

} else {

$large_photo_exists = “”;

$thumb_photo_exists = “”;

}

?>

<div class=”admin-options”>

<?php

global $themename, $shortname, $options8;

if ( $_REQUEST ) echo ‘<div id=”message” class=”updated fade”><p>‘.$themename. __(‘ Featured image 5 Settings saved.’,TEMPLATE_DOMAIN) . ‘</p></div>’;

if ( $_REQUEST ) echo ‘<div id=”message” class=”updated fade”><p>‘.$themename. __(‘ Featured image 5 Settings reset.’,TEMPLATE_DOMAIN) . ‘</p></div>’;

?>

<h4><?php _e(“Featured image 5 Setting”,TEMPLATE_DOMAIN); ?></h4>

<div class=”tab-option”>

<div class=”option-save”>

<?php

if (isset($_POST)) {

//Get the file information

$userfile_name = $_FILES;

$userfile_tmp = $_FILES;

$userfile_type = $_FILES;

$userfile_size = $_FILES;

$filename = basename($_FILES);

$file_ext = substr($filename, strrpos($filename, ‘.’:wink: + 1);

//Only process if the file is a JPG, PNG or GIF and below the allowed limit

if((!empty($_FILES[“image”])) && ($_FILES == 0)) {

foreach ($allowed_image_types as $mime_type => $ext) {

//loop through the specified image types and if they match the extension then break out

//everything is ok so go and check file size

if($file_ext==$ext && $userfile_type==$mime_type){

$error = “”;

break;

} else {

$error = __(“Only”,TEMPLATE_DOMAIN) . ” “.$image_ext.”” . __(” images accepted for upload”,TEMPLATE_DOMAIN) . “
“;

}

}

//check if the file size is above the allowed limit

if ($userfile_size > $max_file ) {

$error.= __(“Images must be under 1 MB in size”,TEMPLATE_DOMAIN);

}

} else {

$error= __(“Select an image for upload”,TEMPLATE_DOMAIN);

}

//Everything is ok, so we can upload the image.

if (strlen($error)==0){

if (isset($_FILES)){

move_uploaded_file($userfile_tmp, $large_image_location);

chmod($large_image_location, 0777);

$width = getWidth($large_image_location);

$height = getHeight($large_image_location);

//Scale the image if it is greater than the width set above

if ($width > $max_width){

$scale = $max_width/$width;

$uploaded = resizeImage($large_image_location,$width,$height,$scale);

} else {

$scale = 1;

$uploaded = resizeImage($large_image_location,$width,$height,$scale);

}

//Delete the thumbnail file so the user can create a new one

if (file_exists($thumb_image_location)) {

unlink($thumb_image_location);

}

}

//Refresh the page to show the new uploaded image

print ‘<meta http-equiv=”Pragma” content=”no-cache”>’;

echo “<h4 id=”loading-bar”>Please wait..Your Image Currently Processing</h4>”;

echo ‘<img src=”‘ . get_template_directory_uri() . ‘/_inc/admin/loading_bar.gif’ . ‘”>’;

print “<meta http-equiv=”refresh” content=”5;url=$ttpl_url/wp-admin/themes.php?page=custom-homepage.php&#tab5″>”;

exit();

//double refresh to clear cache..its a bit catchy but it get the job done

}

}

// normal upload

if (isset($_POST[“normal_upload5”])) {

//Get the file information

$userfile_name = $_FILES;

$userfile_tmp = $_FILES;

$userfile_type = $_FILES;

$userfile_size = $_FILES;

$filename = basename($_FILES);

$file_ext = substr($filename, strrpos($filename, ‘.’:wink: + 1);

//Only process if the file is a JPG and below the allowed limit

if((!empty($_FILES[“image”])) && ($_FILES == 0)) {

foreach ($allowed_image_types as $mime_type => $ext) {

//loop through the specified image types and if they match the extension then break out

//everything is ok so go and check file size

if($file_ext==$ext && $userfile_type==$mime_type){

$error = “”;

break;

} else {

$error = __(“Only”,TEMPLATE_DOMAIN) . ““.$image_ext.”” . __(“images accepted for upload”, TEMPLATE_DOMAIN) . “
“;

}

}

if ($userfile_size > $max_file ) {

$error= __(“ONLY images under 1MB are accepted for upload”, TEMPLATE_DOMAIN);

}

} else {

$error= __(“Select an image for upload”, TEMPLATE_DOMAIN);

}

//Everything is ok, so we can upload the image.

if (strlen($error)==0){

if (isset($_FILES)){

move_uploaded_file($userfile_tmp, $normal_image_location);

chmod($normal_image_location, 0777);

//Delete the thumbnail file so the user can create a new one

if (file_exists($thumb_image_location)) {

unlink($thumb_image_location);

}

}

//Refresh the page to show the new uploaded image

print ‘<meta http-equiv=”Pragma” content=”no-cache”>’;

echo “<h4 id=”loading-bar”>Please wait..Your Image Currently Processing</h4>”;

echo ‘<img src=”‘ . get_template_directory_uri() . ‘/_inc/admin/loading_bar.gif’ . ‘”>’;

print “<meta http-equiv=”refresh” content=”5;url=$ttpl_url/wp-admin/themes.php?page=custom-homepage.php&#tab5″>”;

exit();

//double refresh to clear cache..its a bit catchy but it get the job done

}

}

if (isset($_POST) && strlen($large_photo_exists)>0) {

//Get the new coordinates to crop the image.

$x1 = $_POST[“x1”];

$y1 = $_POST[“y1”];

$x2 = $_POST[“x2”];

$y2 = $_POST[“y2”];

$w = $_POST[“w”];

$h = $_POST[“h”];

//Scale the image to the thumb_width set above

$scale = $thumb_width/$w;

$cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale);

//Refresh the page to show the new uploaded image

print ‘<meta http-equiv=”Pragma” content=”no-cache”>’;

echo “<h4 id=”loading-bar”>Please wait..Your Image Currently Processing</h4>”;

echo ‘<img src=”‘ . get_template_directory_uri() . ‘/_inc/admin/loading_bar.gif’ . ‘”>’;

print “<meta http-equiv=”refresh” content=”5;url=$ttpl_url/wp-admin/themes.php?page=custom-homepage.php&#tab5″>”;

exit();

//double refresh to clear cache..its a bit catchy but it get the job done

}

?>

<?php

//Only display the javacript if an image has been uploaded

if(strlen($large_photo_exists)>0){

$current_large_image_width = getWidth($large_image_location);

$current_large_image_height = getHeight($large_image_location);?>

<script type=”text/javascript”>

function preview(img, selection) {

var scaleX = <?php echo $thumb_width;?> / selection.width;

var scaleY = <?php echo $thumb_height;?> / selection.height;

$(‘#thumbnail + div > img’:wink:.css({

width: Math.round(scaleX * <?php echo $current_large_image_width;?>:wink: + ‘px’,

height: Math.round(scaleY * <?php echo $current_large_image_height;?>:wink: + ‘px’,

marginLeft: ‘-‘ + Math.round(scaleX * selection.x1) + ‘px’,

marginTop: ‘-‘ + Math.round(scaleY * selection.y1) + ‘px’

});

$(‘#x1’:wink:.val(selection.x1);

$(‘#y1’:wink:.val(selection.y1);

$(‘#x2’:wink:.val(selection.x2);

$(‘#y2’:wink:.val(selection.y2);

$(‘#w’:wink:.val(selection.width);

$(‘#h’:wink:.val(selection.height);

}

$(document).ready(function () {

$(‘#save_thumb’:wink:.click(function() {

var x1 = $(‘#x1’:wink:.val();

var y1 = $(‘#y1’:wink:.val();

var x2 = $(‘#x2’:wink:.val();

var y2 = $(‘#y2’:wink:.val();

var w = $(‘#w’:wink:.val();

var h = $(‘#h’:wink:.val();

if(x1==”” || y1==”” || x2==”” || y2==”” || w==”” || h==””:wink:{

alert(“You must make a selection first”:wink:;

return false;

} else {

return true;

}

});

});

function selectionStart(img, selection) { width:260;height:150 }

$(window).load(function () {

$(‘#thumbnail’:wink:.imgAreaSelect({ onSelectStart: selectionStart, resizable: true, x1: 20, y1: 20, x2: 280, y2: 170, aspectRatio: ’28:17′, onSelectChange: preview });

});

</script>

<?php } ?>

<?php

if (isset($_POST)){

unlink($upload_path . $large_image_name);

unlink($upload_path . $thumb_image_name);

echo “<h5 id=’file-delete’>” . __(‘File successfully deleted’, TEMPLATE_DOMAIN) . “</h4>”;

print “<meta http-equiv=”refresh” content=”1;url=$ttpl_url/wp-admin/themes.php?page=custom-homepage.php&#tab5″>”;

exit();

}

if (isset($_POST[“delete_normal_upload5”])){

unlink(“$upload_path/$normal_image_name”:wink:;

echo “<h5 id=’file-delete’>” . __(‘File successfully deleted’, TEMPLATE_DOMAIN) . “</h4>”;

print “<meta http-equiv=”refresh” content=”1;url=$ttpl_url/wp-admin/themes.php?page=custom-homepage.php&#tab5″>”;

exit();

}

?>

<?php

//Display error message if there are any

if(strlen($error)>0){

echo “<p class=”uperror”>” . __(“Error!”,TEMPLATE_DOMAIN) . ” ” . $error . “</p>”;

}

if(strlen($large_photo_exists)>0 && strlen($thumb_photo_exists)>0) { ?>

<img src=”<?php echo “$upload_url/$thumb_image_name”; ?>” class=”timg”/>

<form id=”form-del” name=”thumbnail” action=”” method=”post”>

<div class=”submit”><input type=”submit” name=”delete_thumbnail5″ class=”sbutton button-secondary” value=”<?php _e(“Delete This Image”,TEMPLATE_DOMAIN); ?>” /></div>

</form>

<?php } else if(strlen($normal_photo_exists)>0 ){ ?>

<img src=”<?php echo “$upload_url/$normal_image_name”; ?>” class=”timg”/>

<form id=”form-del” name=”thumbnail” action=”” method=”post”>

<input type=”submit” name=”delete_normal_upload5″ class=”button-secondary” value=”Delete This Image” />

</form>

<?php } ?>

<?php

if(strlen($large_photo_exists)>0 && strlen($thumb_photo_exists)>0){ ?>

<?php } else { ?>

<?php if(strlen($large_photo_exists)>0){ ?>

<h3><?php _e(‘Crop And Save Your Thumbnail’, TEMPLATE_DOMAIN); ?></h3>

<div>

<img src=”<?php echo “$upload_url/$large_image_name”; ?>” style=”clear: both; margin-bottom: 10px;” id=”thumbnail” alt=”Create Thumbnail” />

<br style=”clear:both;”/>

<form name=”thumbnail” action=”” method=”post”>

<input type=”hidden” name=”x1″ value=”” id=”x1″ />

<input type=”hidden” name=”y1″ value=”” id=”y1″ />

<input type=”hidden” name=”x2″ value=”” id=”x2″ />

<input type=”hidden” name=”y2″ value=”” id=”y2″ />

<input type=”hidden” name=”w” value=”” id=”w” />

<input type=”hidden” name=”h” value=”” id=”h” />

<input type=”submit” name=”upload_thumbnail5″ class=”button-secondary” value=”Save Thumbnail” id=”save_thumb” />

</form>

</div>

<?php } } ?>

<?php if(strlen($large_photo_exists)==0 && strlen($normal_photo_exists)==0){ ?>

<h3><?php _e(“Upload Image”,TEMPLATE_DOMAIN); ?> <?php echo $thumb_width . ‘ X ‘ . $thumb_height; ?></h3>

<form name=”photo” enctype=”multipart/form-data” action=”<?php echo admin_url(‘themes.php?page=custom-homepage.php&#tab5’:wink:; ?>” method=”post”>

<input type=”file” class=”ups” name=”image” />

<input type=”submit” class=”button-secondary” name=”upload5″ value=”Upload and crop»” />   <input type=”submit” class=”button-secondary” name=”normal_upload5″ value=”Upload »” />

<p class=”onlyjpg”>* only <?php echo $image_ext; ?> image file are allowed</p>

</form>

<?php } ?>

<form method=”post”>

<?php foreach ($options8 as $value) { ?>

<?php

switch ( $value ) {

case ‘text’:

?>

<div class=”description”><?php echo $value; ?></div>

<p><input name=”<?php echo $value; ?>” class=”myfield” id=”<?php echo $value; ?>” type=”<?php echo $value; ?>” value=”<?php if ( get_option( $value ) != “”:wink: { echo get_option( $value);

} else {

echo $value; } ?>” />

</p>

<?php

break;

case ‘textarea’:

?>

<?php

$valuex = $value;

$valuey = stripslashes($valuex);

$video_code = get_option($valuey);

?>

<div class=”description”><?php echo $value; ?></div>

<p><textarea name=”<?php echo $valuey; ?>” class=”mytext” cols=”40%” rows=”8″ /><?php if ( get_option($valuey) != “”:wink: { echo stripslashes($video_code); } else { echo $value; } ?></textarea></p>

<?php

break;

default;

?>

<?php

break;

} ?>

<?php } ?>

<p class=”submit”>

<input name=”save” type=”submit” class=”sbutton button-primary” value=”<?php _e(“Save setting”,TEMPLATE_DOMAIN); ?>” />

<input type=”hidden” name=”action” value=”save8″ />

</p>

</form>

<form method=”post”>

<p class=”submit”>

<input name=”reset” type=”submit” class=”sbutton button-primary” value=”<?php _e(“Reset setting”,TEMPLATE_DOMAIN); ?>” />

<input type=”hidden” name=”action” value=”reset8″ />

</p>

</form>

</div>

</div>

</div>

</div><!– end tabc –>

After all of this I notice that the “Service Headline #” doesn’t appear on the new boxes. Worse case I add manual links to the networks inside the Service-mode.php file. I’m so close so if anyone can assist, without directing me to pay for a developer, I’d appreciate it. :wink: