How to get tags and categories?

get_the_terms( $id, $taxonomy ); is what you’re looking for, I guess. You can pass array as $taxonomy param. So this snippet: $posttags = get_the_terms($post->ID, array(‘category’, ‘post_tag’)); should do exactly what you’re trying to achieve.

Display pages from specific page template

Use get_post_field(‘post_content’, $product_page->ID ) to get the content outside loop. <?php $product_pages_args = array( ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘page_library_html.php’ ); $product_pages = get_pages( $product_pages_args ); ?> <?php foreach ( $product_pages as $product_page ) { echo ‘<div id=”posts” class=”flex_100″>’; echo ‘<div id=”library_title”><a href=”‘ . get_permalink( $product_page->ID ) . ‘”>’ . $product_page->post_title . ‘</a></div>’; echo ‘<div … Read more

how to call new widgets in sidebar in custom theme?

I will put a basic code to create new widget. In WordPress its call register_sidebar; In your code, you have not put ID. Id=>your-widget-id Put this code into your functions.php function my_widget(){ register_sidebar( array( ‘name’ => __( ‘Front Sidebar’, ‘yourtheme’ ), ‘id’ => ‘sidebar-1’, ‘description’ => __( ‘This is description’, ‘yourtheme’ ), ‘before_widget’ => ‘<aside>’, … Read more

Add space to the end on a widget

In your style.css add this: .widget { margin-bottom: 20px; } That should give all your widgets 20 pixels of spacing but only works when the widgets are stacked on top of eachother. If you have multiple sidebars and only want this to happen on a single sidebar, add a more-specific selector i.e. .my-special-sidebar .widget { … Read more

Code to Show for One post only in head

Write a function, and define it as a callback on the wp_head hook: <?php /** * print a alternate link on head for a several post * * @wp-hook wp_head * @return void */ function wpse_162849_print_alternate_link() { //don’t do anything expect on singular pages if ( ! is_singular() ) return; // check the global post … Read more

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