Make ‘Page’ slug the ‘index’

I would take the current code you have and drop it into a page template called tpl-news.php or whatever you choose. Add the following to the header before your index.php code: <?php /* Template Name: News */ //Add your index.php code here //You can also use wp_redirect(home_url()) here as well if I misunderstood your question … Read more

Post count by Parent Category

Here we’ll use the function – get_categories() to grab all the available categories and store it as array, Then we’ll loop through the array to display the list. Within the foreach loop we did a conditional check that is to determine if category is parent if so print it. <?php $categories = get_categories(); echo ‘We … Read more

How do i put a dropdown list of ALL my post in the sidebar menu?

<?php // query for all posts $your_query = new WP_Query( ‘posts_per_page=-1’ ); echo ‘<select>’. ‘<option value=”” selected=”selected”>Select a post</option>’; // loop through posts while ( $your_query->have_posts() ) : $your_query->the_post(); echo ‘<option value=”‘; the_permalink(); echo ‘”>’; the_title(); echo ‘</option>’; endwhile; echo ‘</select>’; // reset post data wp_reset_postdata(); ?> Obviously, that does nothing unless you bind some … Read more

jquery: getting contents of #content field on post page

The div #editorcontainer contains a regular textarea #content and an iframe #content_ifr. The #content is filled with the saved contents of the post when the page loads. This means that any live edits of the content won’t be returned when calling jQuery(“#content”).html(). For the same reason, you get an empty string in the case of … Read more

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