Forum Replies Created

Viewing 15 replies - 136 through 150 (of 162 total)
  • Add below code to your single.php:
    <?php comments_template(); ?>

    if(is_user_logged_in()) :
      global $current_user;
      get_currentuserinfo();
      echo $current_user->display_name;
      /* green button stuff here */
    else :
      /* offline stuff */
    endif;
    query_posts('posts_per_page=-1');
     /* write here loop stuff */
    wp_reset_query();
    Forum: Fixing WordPress
    In reply to: How to call image

    How to get the first image attached the post:

    $images = get_children(array(
        'post_parent' => $post->ID,
        'post_type' => 'attachment',
        'post_mime_type' => 'image',
        'orderby' => 'ID',
        'order' => 'ASC'
      ));
      if($images){
        $ids = array_keys($images);
        $id = $ids[0];
        $url = wp_get_attachment_image_src($id);
      }else{
        /* no image */
      }

    In your page.php:

    <?php
    get_header();
    
    query_posts('cat=123');
    if(have_posts()) :
      while(have_posts()) :
        the_post();
        ?><li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li><?php
      endwhile;
    else :
      ?><li>No posts.</li><?php
    endif;
    wp_reset_query();
    
    get_footer();
    ?>

    Upload your header image to ‘your theme folder/img’,
    and write below code in your style.css

    #header {
    background:transparent url(img/your-header-image-filename.png) no-repeat center bottom;
    height:160px; /* your header image height */
    }

    Try my response on No Gallery Tab!!

    use

    <?php
      endwhile;
      endif;
      wp_reset_query();
    ?>

    instead of

    <?php
      endif;
      wp_reset_query();
    ?>

    /* write here the rest of your code */

    lines from 30 to 67 of the code for the Archives page on your first post.

    WordPress 2.9.1

    Create admin-script.js in theme folder and edit:

    jQuery(document).ready(function($){
      $('.cat-checklist')
        .prepend(
          '<li><label class="selectit"><input value="1" type="checkbox" name="remove_categories" id="remove_categories"/> Remove Checked Categories</label></li>'
        );
    });

    functions.php:

    function my_enqueue() {
      wp_enqueue_script('my_admin_script', get_bloginfo('template_url') . '/admin-script.js', array('jquery'), false, true);
    }
    add_action('admin_init', 'my_enqueue');
    
    function my_bulk_edit($action, $result){
      if('bulk-posts' == $action && isset($_GET['remove_categories']) && isset($_GET['post_category'])){
        if(($_GET['action'] != -1 || $_GET['action2'] != -1 ) && ( isset($_GET['post']) || isset($_GET['ids']))){
          $post_ids = isset($_GET['post']) ? array_map( 'intval', (array) $_GET['post'] ) : explode(',', $_GET['ids']);
          $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
        }
        if('edit' == $doaction){
          if(isset($_GET['post_type']) && 'page' == $_GET['post_type']){
            if(! current_user_can('edit_pages'))
              wp_die( __('You are not allowed to edit pages.'));
          } else {
            if(! current_user_can( 'edit_posts' ))
              wp_die( __('You are not allowed to edit posts.'));
          }
    
          $post_IDs = array_map('intval', (array) $_GET['post']);
          if(is_array($_GET['post_category']) && ! empty($_GET['post_category'])){
            $remove_cats = array_map('absint', $_GET['post_category']);
            unset($_GET['post_category']);
            foreach($post_IDs as $post_ID){
              if(wp_check_post_lock($post_ID)) continue;
              $cats = (array) wp_get_post_categories($post_ID);
              $post_data['post_category'] = array_diff($cats, $remove_cats);
              $post_data['ID'] = $post_ID;
              wp_update_post($post_data);
            }
          }
        }
      }
    }
    add_action('check_admin_referer', 'my_bulk_edit', 10, 2);

    Check ‘Remove Checked Categories’ and categories you want to remove!

    display all posts

    All posts under a certain category? or,
    All content of each post under a certain category?

    If you mean ‘All posts under a certain category’,
    create ‘page-hound-group.php’ and write below code.

    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <div id="content">
    <?php
     query_posts('cat=467&showposts=-1');
     if (have_posts()) :
      while(have_posts()) :
        the_post();
    ?>
     /* write here the rest of your code */
    <?php
      endif;
      wp_reset_query();
    ?>
    </div>
    <?php get_footer(); ?>

    If you mean ‘All content of each post under a certain category’,
    create ‘page-hound-group.php’ and paste your all code.
    And use
    <?php the_content(); ?>
    instead of

    <?php if(function_exists('the_content_limit')) { ?>
    <?php the_content_limit(350);  ?>
    <?php } else { ?>
    <p> Activate the limitpost plugin to see the post contents ! </p>
    <?php } ?>

    Forum: Fixing WordPress
    In reply to: No Gallery Tab!!

    Maybe, you click on “add image” and upload before new page is saved.
    Usually, uploaded images have its parent. But I think your images have not their parent because of your clicking is too fast.

    try this:
    1. Open new post.
    2. Enter the title.
    3. Focus on content area.
    4. wait.
    5. Draft post is saved.
    6. Click on “add image” and upload images.

    If you kill the auto saving like:

    function disableAutoSave(){
      wp_deregister_script('autosave');
    }
    add_action('wp_print_scripts', 'disableAutoSave');

    You must fail. Enable auto saving.

    #sidebar ul{list-style:none;}
    #sidebar ul li ul li{
      margin:0;
      padding:0 0 4px 20px;
      background:url(images/gobutton2.gif) left top no-repeat;
    }

    oh, use
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    instead of
    <li><?php the_permalink(); ?></li>

    if(is_front_page() || is_home() || is_single() || is_archive()){
      // YOUR BANNER HERE
    }

    or simply,

    if(! is_page()){
      // YOUR BANNER HERE
    }

Viewing 15 replies - 136 through 150 (of 162 total)