AVForums

Our philosophy in our forums, reviews, podcasts and feature videos is to promote audio and visual excellence by gathering and sharing the best information and resources available.

Help

To begin please visit our help section »

Not a Member Yet?

It only takes a minute to start enjoying the benefits of AVForums membership, and it's free!

Member Log in

Help with php coding please

Post Reply
Old 16-11-2008, 3:54 PM   #1
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Help with php coding please

I am struggling along with my Wordpress blog and am slowly but surely getting there. I am hamstrung by the fact that whilst I can muddle through simple html I don't understand php at all.

I have a problem with one of the sidebars as it includes "Popular Tags" which I quite like but I don't like the way that the more a tag has been used the larger the tag appears in the sidebar. This is helped by the fact that the most used tag is four words totalling about 40 characters and the tag is so large that it's off the page.

I am attaching the coding for the sidebar in the hope that making the tags all the same size is something fairly simple and I have coloured in red the section that I think is relevant although I may be miles out.

Quote:
<div class="sidebar last"><!--Sidebar Right -->
<div id="sub_feed">
<a href="<?php bloginfo('rss2_url');?>">
<img src="<?php bloginfo('template_url'); ?>/images/subscribe180x40.jpg"></a><!-- Enter Your Feed URL Here -->
</div>
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<div class="box"><!--search-->
<h3>Search</h3>
<div class="row">
<input type="text" value="<?php the_search_query(); ?>" class="search" name="s" id="s" size="20" />
<input type="image" id="submit" src="<?php bloginfo('template_url'); ?>/images/go.gif" value="submit" class="submit" />
</div>
<div class="clear"></div>
<div class="cap"></div>
</div><!--/Search box-->
</form>
<div class="box" id="subscribe"> <!--subscriber-->
<h3>Subscribe</h3>
<ul>
<li id="s-yahoo"><a href="http://add.my.yahoo.com/rss?url=<?php bloginfo('rss2_url');?>">Yahoo</a></li>
<li id="s-google"><a href="http://fusion.google.com/add?feedurl=<?php bloginfo('rss2_url');?>">Google</a></li>
<li id="s-bloglines"><a href="http://www.bloglines.com/sub/<?php bloginfo('rss2_url');?>">Bloglines</a></li>
<li id="s-newsgator"><a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=<?php bloginfo('rss2_url');?>">newsgator</a></li>
<li id="s-rss"><a href="<?php bloginfo('rss2_url');?>">RSS</a></li>
</ul>
<!-- Uncomment Below Code for Email Base Subscription -->
<!--<div class="box" id="mailinglist">
<h4>Subscribe By Email</h4>
<form id='mailinglist_form' method="post" action="">
<input type="text" name="email" value="" class="email" />
<input type="image" src="<?php bloginfo('template_url'); ?>/images/add.gif" value="Sign Up" name="email-button" />
</form>
</div> -->
<div class="cap"></div>
</div><!--/Subscribe box-->
<div class="box">
<h3>Categories</h3>
<ul>
<?php wp_list_categories('show_count=1&title_li='); ?>
</ul>
<div class="cap"></div>
</div><!--/Catagory box -->
<div class="button" id="bookmark">
<a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?wt=nw&pub=deannab&url='+encodeURIComp onent(location.href)+'&title='+encodeURIComponent( document.title), 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,re sizable=yes,toolbar=no,location=no,status=no,scree nX=200,screenY=100,left=200,top=100'); return false;" title="Bookmark using any bookmark manager!" target="_blank">Bookmark</a>
</div><!--/bookmark-->
<!-- Widgetized right sidebar -->
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('right_sidebar') ) : ?>
<?php endif; ?>
<div class="box" id="tagcloud">
<h3>Popular Tags</h3>
<ul>
<?php wp_tag_cloud('smallest=8&largest=18&number=30&orde rby=count&order=DESC'); ?>
</ul>
<div class="cap"></div>
</div><!--/tagcloud box-->
<div class="box" id="archives">
<h3>Archives</h3>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
<div class="cap"></div>
</div><!--/archive box-->
</div><!--/sidebar-->
  Quote
Old 16-11-2008, 4:03 PM   #2
Member
Join Date: Jan 2006
Experience Points:
2,542, Level: 11
Points: 2,542, Level: 11 Points: 2,542, Level: 11 Points: 2,542, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 7, Got 79
Posts: 358
Re: Help with php coding please

I don't know php, but I'd try this:
<?php wp_tag_cloud('smallest=8&largest=8&number=30&order by=count&order=DESC'); ?>
  Quote
Old 16-11-2008, 4:40 PM   #3
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

Richard - it is rather obvious when you look closely at it. Thanks very much as it worked a treat.

The only other problem that I would like to address is that even with the tags now all the same size one or two are still too long for the sidebar and stick out of the right had side rather than wrap round. If there is no cure for that I suppose I can live with it.

Thanks again
  Quote
Old 16-11-2008, 5:05 PM   #4
Senior Member
 
Paul_HDLover's Avatar
Join Date: Jan 2007
Location: Edinburgh
Experience Points:
3,569, Level: 14
Points: 3,569, Level: 14 Points: 3,569, Level: 14 Points: 3,569, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 219, Got 93
Posts: 1,149
Re: Help with php coding please

Ian where are you getting the popular tags values from? I cant see them in the above code?
  Quote
Old 16-11-2008, 5:23 PM   #5
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

I haven't a clue as I don't understand php or SQL at all but they are definitely appearing on the blog sidebar
  Quote
Old 16-11-2008, 5:40 PM   #6
Senior Member
 
Paul_HDLover's Avatar
Join Date: Jan 2007
Location: Edinburgh
Experience Points:
3,569, Level: 14
Points: 3,569, Level: 14 Points: 3,569, Level: 14 Points: 3,569, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 219, Got 93
Posts: 1,149
Re: Help with php coding please

linky?
  Quote
Old 16-11-2008, 7:14 PM   #7
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

Quote:
Originally Posted by Paul_HDLover View Post
Ian where are you getting the popular tags values from? I cant see them in the above code?
The tag values are generated by a separate plugin which then displays them in the sidebar using the code in red.
  Quote
Old 16-11-2008, 7:29 PM   #8
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

Quote:
Originally Posted by Ian J View Post
The only other problem that I would like to address is that even with the tags now all the same size one or two are still too long for the sidebar and stick out of the right had side rather than wrap round. If there is no cure for that I suppose I can live with it.
If you can't find out how to do it with the plugin or code itself and depending on the theme used you may be able to increase the width of the sidebar slightly to make the text fit but this may throw your sites design out of whack and if images are used for the sidebar it won't look too good.

The width of the sidebar is probably contained in style.css so have a look in there if you want to give it a try and it'll be in the sidebar section saying something like width:180px;

EDIT: Failing that you could just install a different tag cloud generator from the Wordpress plugins directory.

Last edited by WibXL; 16-11-2008 at 7:43 PM.
  Quote
Thanks from:
Ian J (17-11-2008)
Old 17-11-2008, 8:53 AM   #9
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

Thanks Wib. I did take your suggestion and looked at alternative plugins but they all looked a bit complicated so I just edited the sidebar and removed all of the coding for the tags so now it doesn't appear at all which doesn't really worry me.
  Quote
Old 17-11-2008, 9:10 AM   #10
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

No problem, was it the plugins themselves that looked complicated or installing them as there is another plugin that will automate the process for you and to install it is just a matter of unzipping it and then uploading it to your plugins folder.
  Quote
Old 17-11-2008, 10:30 AM   #11
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

I can manage to install plugins but sometimes I get defeated by setting them up afterwards as I don't understand the instructions. I've installed a couple of interesting looking plugins so far that I can't get to work as I don't understand the setup options.

Still, it's good fun learning
  Quote
Old 17-11-2008, 10:53 AM   #12
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

Since setting up my new blog I've been trying to stick to plugins that come with a built in sidebar widget as you don't need to edit any code yourself but some of the instructions can be lacking in places. I tend to just mess about with any options that I don't understand to see what they do and hope that I don't break anything in the process.

If you're going to take that approach though backing up your site first would be a good idea but most of the time any problems can be solved simply by deleting the messed up plugins folder.

It'd be nice of all of the plugin settings pages were in the same place as at the moment they seem to be everywhere which doesn't help.
  Quote
Old 18-11-2008, 5:33 PM   #13
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

I'm stuck again.

I would like a facility that shows if there are any comments for each blog post and preferably that you can click on to take you to view them.

At the moment there is no way of knowing if there are any comments or not for a given post unless you click the header to be taken to that page. I am worried that people will stop visiting and posting comments if they think that they are not appearing.
  Quote
Old 18-11-2008, 5:49 PM   #14
Illustrious Member
 
signs's Avatar
Join Date: Nov 2005
Location: nr burton on trent
Experience Points:
30,704, Level: 42
Points: 30,704, Level: 42 Points: 30,704, Level: 42 Points: 30,704, Level: 42
Activity: 42.0%
Activity: 42.0% Activity: 42.0% Activity: 42.0%
Thanks: Gave 1,187, Got 2,118
Posts: 16,716
Re: Help with php coding please

Quote:
Originally Posted by Ian J View Post
I'm stuck again.

I would like a facility that shows if there are any comments for each blog post and preferably that you can click on to take you to view them.

At the moment there is no way of knowing if there are any comments or not for a given post unless you click the header to be taken to that page. I am worried that people will stop visiting and posting comments if they think that they are not appearing.

Pm Bob (Mr incredible) he's hot on this i believe
  Quote
Thanks from:
Ian J (18-11-2008)
Old 18-11-2008, 6:24 PM   #15
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

Quote:
Originally Posted by Ian J View Post
I'm stuck again.

I would like a facility that shows if there are any comments for each blog post and preferably that you can click on to take you to view them.

At the moment there is no way of knowing if there are any comments or not for a given post unless you click the header to be taken to that page. I am worried that people will stop visiting and posting comments if they think that they are not appearing.
You could use a theme that already has the facility built in, I use Aerodrome from here and it works pretty well for that. Or you could use the recent comment widget that's built in to Wordpress to show say ten recent comments in your sidebar. That can be found in dashboard>design>widgets.

There is also a plugin that will allow your users to recieve comment updates via email but I can't remember the name of it at the moment. One of the easiest ways though would be to try to get your users to sign up to your comments RSS feed to have the comments sent straight to a RSS reader.

EDIT: The plugin is called subscribe to comments but it looks like there might be problems with it when used with the lastest version of wordpress.

Last edited by WibXL; 18-11-2008 at 6:27 PM.
  Quote
Thanks from:
Ian J (19-11-2008)
Old 19-11-2008, 9:04 AM   #16
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

Quote:
Originally Posted by WibXL View Post
Or you could use the recent comment widget that's built in to Wordpress to show say ten recent comments in your sidebar. That can be found in dashboard>design>widgets.
Just found and installed that one. It's not ideal but better than nothing.

As a matter of interest I have been blogging for a couple of years using Blogspot which is owned by Google and scribbling about the niche area of commercial finance that I work in. Although I get hits to the site on specific posts that I have made the blog has never been rated by Google for it's main keyword.

Six weeks ago I bought a domain with the keyword plus the word "blog" plus a cheap hosting package and just have the blog on the site. Google has already rated it numbers one and two for "keyword" blog which seems to imply that they prefer blogs hosted elsewhere rather than on their own site.
  Quote
Old 21-11-2008, 2:08 PM   #17
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

I've been trying to find a way to integrate my blog a bit better with phpBB and whilst I'm still trying to workout how to do that Ihave managed to find a solution to your comment problem. The line of code below should be added main index template(index.php):

Code:
<p>This post currently has 
<?php comments_number('no responses','one response','% responses'); ?>.</p>
Look for the something like this block of code and insert the code above in it somewhere depending on where you want it, I'd suggest either at the beginning or the end:

Code:
Written by <?php the_author() ?><?php _e(" in:"); ?> <?php the_category(',') ?> | <?php the_tags(__('Tags: '), ', ', ' '); ?><?php edit_post_link(__('Edit This')); ?>
<?php wp_link_pages(); ?><br />
There is one problem in that your theme may have named it's files differently and as such may not have a main index template(index.php) file but if you can't get it sorted let me know what theme you use and I'll see if I can.

EDIT: You probably don't need to be told this but backup the file first in case something should go wrong.
  Quote
Old 21-11-2008, 2:18 PM   #18
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

I tried that out and whilst it gave a notation that the number of comments is X it doesn't provide a clickable link to take you to them.

Unfortunately many of my readers aren't web literate.

The theme designer has done a more recent theme that does incorporate what I want but unfortunatly I don't like the rest of it but perhaps it might give a clue to how it's done.

I'll PM you the URL of my blog so that you can have a look at it
  Quote
Old 21-11-2008, 2:41 PM   #19
Prominent Member
 
WibXL's Avatar
Join Date: May 2006
Experience Points:
6,038, Level: 18
Points: 6,038, Level: 18 Points: 6,038, Level: 18 Points: 6,038, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Thanks: Gave 293, Got 383
Posts: 3,097
Re: Help with php coding please

Quote:
Originally Posted by Ian J View Post
I tried that out and whilst it gave a notation that the number of comments is X it doesn't provide a clickable link to take you to them.

Unfortunately many of my readers aren't web literate.

The theme designer has done a more recent theme that does incorporate what I want but unfortunatly I don't like the rest of it but perhaps it might give a clue to how it's done.

I'll PM you the URL of my blog so that you can have a look at it
This is the code that you need to add:

Code:
<?php wp_link_pages(); ?>
				<?php comments_popup_link(__('<strong>Comments (0)</strong>'), __('<strong>Comments (1)</strong>'), __('<strong>Comments (%)</strong>')); ?>
You may need to experiment a bit with placement though to get it to look right and maybe get rid of the strong tags to make it fit in a bit better.

EDIT: It would appear that you don't need to add this bit <?php wp_link_pages(); ?>

Last edited by WibXL; 21-11-2008 at 2:57 PM.
  Quote
Old 21-11-2008, 4:24 PM   #20
Eminent Member
 
Ian J's Avatar
Join Date: Aug 2001
Location: Midlands
Experience Points:
71,654, Level: 65
Points: 71,654, Level: 65 Points: 71,654, Level: 65 Points: 71,654, Level: 65
Activity: 0.8%
Activity: 0.8% Activity: 0.8% Activity: 0.8%
Blog Entries: 3
Thanks: Gave 3,114, Got 4,720
Posts: 23,949
Re: Help with php coding please

WibXL - you are superstar
  Quote
Thanks from:
WibXL (21-11-2008)
Post Reply



Thread information and display options
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off