All About Wordpress - Themes, Plugins, Tips and Tweaks

Do you have a Self-Hosted Wordpress Blog ?


  • Total voters
    76
Status
Not open for further replies.

naveen_reloaded

!! RecuZant By Birth !!
ya .. ok.. can u point to other good theme and also help me in other question of mine regarding permalink..

ok to my question simple...

wht is ur permalink structure..?

anyway i installed a plugin to add .html to all articles... so now i can submit it to digg...

but i want permalink to be like htpp:/xxxxxxxxxxx.co.cc/post-article-name.html

that would be nice ... a\or say easy for others to read from the link itself...
 

iMav

The Devil's Advocate
If you are on WordPress:

Admin panel -> Settings -> Permalinks -> Custom Structure -> /%postname%/
 

axxo

99.9% Idle
Someone plz help me in finding this theme..

*www.blogstheme.com/preview/wp-content/themes/nt-nature-life/screenshot.jpg
 

naveen_reloaded

!! RecuZant By Birth !!
guys i have ran into a problem..

i have been using his *wordpress-plugins.biggnuts.com/adsense-plugin/

a adsense random injector of the java code inthe article...

but when i go to adsense dashboard and see , i see very less impression when my site is doing a 200-300 daily...

wht is wrong .. wht should i do .. reply fast.. guys...
 

prasad_den

Padawan
Got a doubt.
Suppose I have 4 different pages in my blog, for eg. news, reviews, tech, gossip. Now is there any way by which whenever I publish a new post with "tech" as a tag (or something similar), then it automatically is published in the tech page only and not in the others..? I hope I am clear enough. :(

^^ That was just an example. :) Ok. Lets say that I assign a post to a particular category, tech. Now I want an option or plugin or some mod which will make sure that all my posts which are categorised as tech are published in the tech page only. They should not be visible in the home page or anywhere else. Is it possible?

As a follow-up to what I had asked earlier, I finally found a simple solution through which you can make your posts appear in new pages that you create. WP usually allows you to create only static new pages like About Me, Feedback, Contact us, etc.. You cannot publish new posts in these pages you have created. But with a plugin called inline posts, this has become very much possible. Install this plugin, and then all you have to do is edit the page where the post has to be published, and the following code there:
[[post id]]
Thats it..
Hope it is helpful.. :D
 

naveen_reloaded

!! RecuZant By Birth !!
Actually i use adsense in 3 sites of mine...

But since i use google analytical i know how much visitors come daily...but that doesnt correlate with impression ...

Is any one using the same plugin as i mentioned in my prev post?
 

blackpearl

The Devil
How to show categories in a navigation bar at the top?
I have a theme ready with a navigation bar showing pages. I want to replace pages with categories. Actually I did, but styles such as "hover" and "current item" does not work. It just shows the plain boring categories with no effects. How to do it?

Just as an example here is the code to show pages in navigation bar:

<?php //highlight 'Blog' if not Page
if (is_page()) {
$highlight = "page_item";
} else {
$highlight = "page_item current_page_item";
}
?>

<div>
<ul id="supernav">
<li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>">Blog</a></li>
<?php wp_list_pages('title_li='); ?>
</ul>
</div>
 

Faun

Wahahaha~!
Staff member
How to show categories in a navigation bar at the top?
I have a theme ready with a navigation bar showing pages. I want to replace pages with categories. Actually I did, but styles such as "hover" and "current item" does not work. It just shows the plain boring categories with no effects. How to do it?

Just as an example here is the code to show pages in navigation bar:
may be you can give content of the modified header, style.css and the original header here.

some css mash up is needed
*s269.photobucket.com/albums/jj44/visio159/Unismilies/12.png
 

blackpearl

The Devil
OK. Here are the codes:

CSS said:
#nav ul {
margin:0;
padding:0;
list-style-type:none;
background:url('images/nav-strip.gif') repeat-x top left;
height:37px;
}
#nav li {
padding:0;
margin:0;
height:37px;
float:left;
list-style-type:none;
}
#nav li a {
display:block;
height:27px;
padding:10px 15px 0 15px;
text-decoration:none;
color:#ffffff;
font-size:11px;
text-align:center;
font-weight:bold;
float: left;
}
#nav .main {
background:url('images/nav-strip.gif') repeat-x;
color:#006600;
}
#nav .main a {
background:url('images/nav-strip.gif') repeat-x;
font-weight:bold;
color:#ffffff;
}
#nav .main a:hover {
background:url('images/nav-hover.gif') no-repeat top center;
font-weight:bold;
color:#ffffff;
}
#nav .main #current {
background:url('images/nav-active.gif') repeat-x;
color:#000000;
}
#nav .main #current a {
background:url('images/nav-active.gif') repeat-x;
font-weight:bold;
color:#000000;
}
#nav .main #current a:hover {
background:url('images/nav-active.gif') repeat-x;
font-weight:bold;
color: #000000;
}
#nav .normal {
color:#006600;
font-weight:bold;
}
#nav .normal a {
background:url('images/nav-strip.gif') repeat-x;
color:#ffffff;
}
#nav .normal a:hover {
background:url('images/nav-hover.gif') no-repeat top center;
color:#ffffff;
}
#nav .normal #current {
background:url('images/nav-active.gif') repeat-x;
color:#000000;
}
#nav .normal #current a {
background:url('images/nav-active.gif') repeat-x;
color:#000000;
}
#nav .normal #current a:hover {
background:url('images/nav-hover.gif') no-repeat top center;
color: #ffffff;
}

Header Original said:
<div id="nav">
<li class="main"><a <?php if (is_home()) echo " id=\"current\""; ?> href="<?php bloginfo('url'); ?>/">Home</a></li>
<?php
$pages = my_get_pages();
if ($pages) {
foreach ($pages as $page) {
$page_id = $page->ID;
$page_title = $page->post_title;
$page_name = $page->post_name;
if ($page_name == "archives") {
// (is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' ':$selected='';
(is_page($page_id) || is_archive() || is_search() || is_single())?$selected = ' id="current"':$selected='';
echo "<li".$selected." class=\"normal\"><a href=\"".get_page_link($page_id)."\">Archives</a></li>\n";
}
elseif($page_name == "about") {
(is_page($page_id))?$selected = ' id="current"':$selected='';
echo "<li class=\"normal\"><a".$selected." href=\"".get_page_link($page_id)."\">About</a></li>\n";
}
elseif ($page_name == "contact") {
(is_page($page_id))?$selected = ' id="current"':$selected='';
echo "<li class=\"normal\"><a".$selected." href=\"".get_page_link($page_id)."\">Contact</a></li>\n";
}
elseif ($page_name == "about_short") {/*ignore*/}
else {
(is_page($page_id))?$selected = ' id="current"':$selected='';
echo "<li class=\"normal\"><a".$selected." href=\"".get_page_link($page_id)."\">$page_title</a></li>\n";
}
}
}
/* Many thanks to Blix creator Sebastian Schmieg for his PHP scripting, get Blix - *www.kingcosmonaut.de/blix/ */
?>
</ul>
</div>

Header modified said:
<div id="nav">
<ul>
<li class="main"><a <?php if (is_home()) echo " id=\"current\""; ?> href="<?php bloginfo('url'); ?>/">Home</a></li>
<li class="main">
<?php wp_list_cats('sort_column=name'); ?>
<?php // wp_list_categories('show_count=0&title_li=<h2>Categories</h2>'); ?>
</li>
</ul>
</div>

The categories are appearing in the navigation bar. But hover and active tab effects have disappered.
 

Faun

Wahahaha~!
Staff member
OK. Here are the codes:

The categories are appearing in the navigation bar. But hover and active tab effects have disappered.
the main problem here is that you are just listing the categories(wp_list_cats, thought its a deprecated function now) but there is no point at which you have applied "current" as id to the active category.

So hovering effect fails. There is a neater way to do this.

The code will be like this
Code:
<?php 
  $categories=  get_categories(); 
  foreach ($categories as $cat) {
      
    (is_category($cat->cat_name))?$selected = ' class="selected"':$selected='';

                       echo "<li".$selected."><a href=\"".get_category_link($cat)."\">$cat->cat_name
</a></li>\n";

                   
  }
 ?>
PS: I can't guarantee but this code is the first step to make it work.
 
Last edited:

blackpearl

The Devil
the main problem here is that you are just listing the categories(wp_list_cats, thought its a deprecated function now) but there is no point at which you have applied "current" as id to the active category.

So hovering effect fails. There is a neater way to do this.

Exactly. But I don't know how to do it, so I just listed the categories hoping it would work. :p

Sorry, your code isn't working and I couldn't make any head or tail out of it. :(
I don't know such stuff.
 

Faun

Wahahaha~!
Staff member
Exactly. But I don't know how to do it, so I just listed the categories hoping it would work. :p

Sorry, your code isn't working and I couldn't make any head or tail out of it. :(
I don't know such stuff.


Code:
<?php 
 //Returns an array of category objects matching the query parameters into variable "categories"
$categories=  get_categories(); 
//start for loop and take each entry one by one into "cat" variable
  foreach ($categories as $cat) {
      //below is just a condition checking using tertiary operator (a>b?true:false)
      //is_category returns true for the category specified by name
      // and then it sets the "selected" variable to value  id="current" string (remember ther is a space before id)
      //else "selected" variable will have empty string
    (is_category($cat->cat_name))?$selected = ' class="selected"':$selected='';
       //now just echo the html code along with the       
      echo "<li [B]class=\"normal\"><a".$selected" [/B]href=\"".get_category_link($cat)."\">$cat->cat_name</a></li>\n";
//echo "<li class=\"normal\"><a".$selected." href=\"".get_page_link($page_id)."\">$page_title</a></li>\n";
}
 ?>
There was a mistake in my code, which is rectified now (correctly shown in bold letter). I have commented too to let you understand
 
Last edited:

blackpearl

The Devil
It's not working. It shows an error message about some missing ";" or ",". Couldn't figure out where the error is. Do you know any WP theme that has categories in the navigation bar? I could look into the code.
 

Faun

Wahahaha~!
Staff member
It's not working. It shows an error message about some missing ";" or ",". Couldn't figure out where the error is. Do you know any WP theme that has categories in the navigation bar? I could look into the code.
try this, i forgot the .

PHP:
<?php 
 //Returns an array of category objects matching the query parameters into variable "categories"
$categories=  get_categories(); 
//start for loop and take each entry one by one into "cat" variable
  foreach ($categories as $cat) {
      //below is just a condition checking using tertiary operator (a>b?true:false)
      //is_category returns true for the category specified by name
      // and then it sets the "selected" variable to value  id="current" string (remember ther is a space before id)
      //else "selected" variable will have empty string
    (is_category($cat->cat_name))?$selected = ' class="selected"':$selected='';
       //now just echo the html code along with the       
      echo "<li class=\"normal\"><a".$selected." href=\"".get_category_link($cat)."\">$cat->cat_name</a></li>\n";
//echo "<li class=\"normal\"><a".$selected." href=\"".get_page_link($page_id)."\">$page_title</a></li>\n";
}
 ?>
and yeah here is the site which uses categories in navigation,
*www.trailerflick.com/

but i think those are manually generated. So you can simply write one by one every category and do it the easy way.

give links manually as *yourwebsite,com/category/categoryname


Tell me how many categories you have.
 
Last edited:

iMav

The Devil's Advocate
Yea, in the navigation bar name the links with your category and then use the plugin to link that to /category/whatever

Redirectify
 

blackpearl

The Devil
*www.trailerflick.com/

but i think those are manually generated. So you can simply write one by one every category and do it the easy way.

give links manually as *yourwebsite,com/category/categoryname


Tell me how many categories you have.

I think I have to add them manually. BTW, I will look at your new code too.

iMav: Not sure how that would be helpful.

Anyway, I'm looking for another thing. When I add images, it adds the full URL like "*domain.com/wordpress/image.jpg". How can I make it to use only the relative URL like "/wordpress/image.jpg"?
 
Status
Not open for further replies.
Top Bottom