Tweet Before reading this article it is advised to read “How to run Magento in WordPress“, as it could help you overcome some basic problems that might emerge. This snippet shows you how to get Magento categories and show them in WordPress so you can use them as a menu. Copy following snippet into your [...]
Tweet Many developers like combining Magento and WordPress, and there is many more out there that would like to. All snippets showing how to grab data from Magento don’t warn you that there is the function in Magento core that has the same name as WordPress function for translation “__()”. For this reason it is [...]
In: WordPress
7 Oct 2010Tweet In order to convert category ID to category name in WordPress, you can use get_cat_name(). This is a WordPress function that will help you get category name based on category ID. It can be used when you know category name might be changed, and you know ID will stay the same. See snippet below [...]
Tweet When making customization for our WordPress theme, often we need to check if user is logged in. It is a simple task when using a WordPress function is_user_logged_in(). Here is a simple snippet that shows you how to check if user is logged in or not. 1 2 if(is_user_logged_in()) echo ‘You are logged in.’; [...]
In: WordPress
18 Sep 2010Tweet If you would like to present number of posts on your WordPress blog – than you could use WP function called wp_count_posts(). And if you want to just count published posts, follow the snippet below: echo ‘So far – we have published: ‘ . wp_count_posts()->publish . ‘ posts!’; Example of count posts Stunt snippets [...]
In: WordPress
17 Sep 2010Tweet Sometimes, there is a need to replace WordPress admin logo in wp-admin of your clients website. It is a simple task – simple to do as copying this snippet into your functions.php file, and adding your clients logo to folder images in your WordPress theme. 1 2 3 4 5 6 7 8 9 [...]
In: WordPress
15 Sep 2010Tweet WordPress shortcodes are powerful but rarely used functions. It is simple to use WordPress shortcodes by calling WordPress function add_shortcode. You can use it to show your sharing buttons, RSS feeds, Google AdSense or just your signature. To make this simple function works with you – just copy following snippet into your themes functions.php [...]
Tweet Sometimes there is a need to get posts outside of WordPress. In order to get latest couple of posts and present them as news outside of WP, I have written a function that might be useful. This function has two parameters. First one is database connection, and second is optional array of parameters used [...]