why is markup routinely placed in functions in wordpress?

I think WordPress is one of the cases where the original code just got bigger and bigger without having a chance to be rewritten from ground up with best practices. In this case, I think the WordPress conventional practice (writing markup in function) outweigh the best practices. You might find the theme development documentation interesting … Read more

WordPress editor, change code wrap (bbpress?)

put this code in functions.php add_action(‘wp_footer’,’ravs_codeTag_fix’); function ravs_codeTag_fix(){ if ( bbp_use_wp_editor() ) : ?> <script> jQuery(document).ready( function() { /* Use <code> instead of backticks for the Code button in the editor */ if ( typeof( edButtons ) !== ‘undefined’ ) { edButtons[110] = new QTags.TagButton( ‘code’, ‘code’, ‘<code>’, ‘</code>’, ‘c’ ); QTags._buttonsInit(); } }); </script> … Read more

Anchor Text code string is automatically modified by WordPress

Your problem is that you are using relative URLs– that is URLs, that include only part of the web address. What is taking on your URL is the browser, not WordPress. Browsers have long done this. Here is how it is supposed to work. If you provide an absolute URL nothing happens– for example, http://www.example.com. … Read more

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