Show/Hide comment status text in wordpress

I am again confused if my post title is perfect or not ๐Ÿ™ So let me explain, sometimes we disable comment for any post or page and at last the text shows “Comments are closed” or something else in different ways. But in commercial projects we need to follow some good design where in some posts or pages we may need to enable comment or not. So, let’s put a trick in theme to show the comment text(comment status in more smart way)

In latest wordpress version the loop is in the loop.php file in the theme folder. So for comment we will get this line

<?php comments_template( '', true ); ?

But how about we put

<?php if($post->comment_status == "open"){comments_template( '', true );} ?>

That means if comment is off then we will not show any text like “Comments are closed” . I strongly believe this trick will make the design clean in some condition ๐Ÿ˜›

Thank you

Loading only component in joomla

I am not sure if my post title is perfect about what I want to express ๐Ÿ˜› , let me clear. When we hit any link in joomla that must load any component with modules, header, footer … etc so many things. But what we need to do ย if we want to load only the component part ? Ok if still you are not clear, then go to your template index.php file and check what you do with the following line

<jdoc:include type="component" />

Yes I am talking about how we can load only the component with any link that the above line does.ย let you are in a link in your site for com_content, for me now I am in that link in my local test site.ย http://localhost/jtest/index.php?option=com_content&view=category&layout=blog&id=1&Itemid=50

If I go to the link I see full site. Ok now if I modify the url by appending &tmpl=component at end
http://localhost/jtest/index.php?option=com_content&view=category&layout=blog&id=1&Itemid=50&tmpl=component

I see only the component part. Please try yourself. This is how we can just show the component part. If you check your template folder there is a file named component.php which actually shows if component only link is opens. If that file is missing in your template then find in the system template folder. Also there are another two template files for error.php and offline.php which shows the error page and site offline mode page.

Now let me discuss when you may need to load the component only part. Let’s you want to show something via joomla native popup window, like you want to make popup login you can do this trick. Once I wrote a article about how to make modal (popup window) using joomla native modal javascript library.

Example: go to my joomla demo site ย http://idea52.com/old/ click the feedback button, it will load the com_contact component in joomla native modal window.

Thank you.

Vacation is already great :)

Just back from a long and great vacation ๐Ÿ™‚ May be thing last two years, I didn’t take such long break, around 14 days, yes it’s true ๐Ÿ™‚ Had lots of fun with Family mates. First time some one from my family came dhaka to meet me, My senior brother and sister came to my place in dhaka , I was so happy to see them.

Senior Brother(Sumon) and Sister in law(Vabi) -Sanchita

Continue reading Vacation is already great ๐Ÿ™‚