Ajax call does not work for this custom code

Instead of doing: data: {action: ‘performers’, catname: catname} Try: data: ‘action=performers&catname=”+catname; You may also want to define “catname” globally, i am not sure if scope is an issue with your ajax handler but this could be why it is not being set. As an example try to alert catname within the ajax handler above cache=false; … Read more

Echo a div to header.php from functions.php

The wp_head() template tag is intended to fire in the HTML document head, rather than the page header, and is used to output script and stylesheet links and tags, and other similar things in the HTML document head. It should appear immediately before the closing HTML </head> tag, like so: <?php wp_head(); ?> </head> If … Read more

How to shorten code with function?

You can make your own function to minimize the characters typed for each time you want to repeat the call to get_posts: in functions.php (perhaps): function print_piwa($postcount=2, $cat_id=81) { ?> <div class=”wiadPodtyt”> <ul> <?php $piwa = get_posts(array( ‘posts_per_page’ => $postcount, ‘cat’ => $cat_id, ‘post__not_in’ => $news_ids, ‘offset’ => 1 )); foreach ($piwa as $post) { … Read more

Retrieve current post’s tags

<?php $tags = get_the_tags($post_id); ?> Here $post_id is the ID of the post of which you want to get tags. This is same parameter as passed to get_post(). When used inside the loop $post_id is optional & default to the current post.