WordPress call post-ID in jquery

This question is more of a js/jQuery is then WordPress. I am not going to post a working answer as It is hard to read the html given. And I think how you are doing it is not a effective solution. My answer should guide you towards better solution. First of all you do not … Read more

How to edit the styles for the table of pages/post listed in the admin when you click on pages/posts?

I guess you are in edit.php so you can add style only for this admin page. function enqueue_my_scripts($hook) { if ( ‘edit.php’ != $hook ) { return; } //our script to remove fixed table class echo ‘<script>’; echo ‘$( “.wp-list-table” ).removeClass( “fixed” )’; echo ‘</script>’; } add_action( ‘admin_enqueue_scripts’, ‘enqueue_my_scripts’ ); The explanation is basic first … Read more

How to add post classes?

function imageHolder($id){ $category = get_the_category($id); $class=””category-” . strtolower($category[0]->cat_name) . ‘”‘; print <<<HTML <div class=$class> This is a Test </div> HTML; } imageHolder(‘1′); Please be careful about using ‘/n’ or ‘/r’ symbol in the Heredoc syntax(they might cause the function does not work properly).

Adding post_class into functions.php query

post_class() will echo the class in the format class=”postclassA postclassB” get_post_class() will return an array of all registred classes To use get_post_class() inside sprintf(), you have to return the array as a string. For this purpose you can use the join() function. Example $classes = join(‘ ‘, get_post_class()) $sidebar = sprintf(‘<div id=”post-%s” class=”%s”>%s</div>’, get_the_ID(), $classes, … Read more

Using post_class to style posts indivdually

You should be using post_class (and body_class for that matter) but you don’t need it for this. Alter your Loop on your home page to conditionally format the first post. $first = (!is_paged()) ? true : false; if (have_posts()) { while (have_posts()) { the_post(); if ($first) { // code to format the first post $first … Read more

post_class not working with css

First of all, <?php post_class(); ?> function prints a string that contains html ‘class’ attribute. So, whenever you are using this function inside class attribute, then you are actually printing another class attribute inside class attribute. That’s why your class is not working. Secondly, since <?php the_content(); ?> function may contains <p> tag, that’s why … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)