Forum Replies Created

Viewing 15 replies - 16 through 30 (of 84 total)
  • Forum: Fixing WordPress
    In reply to: Double posting

    Not 100% sure but it looks like your theme is responsible for the double displaying of posts. I’d check to make sure you don’t have multiple loops or multiple the_content(); functions or both the_content(); and the_excerpt(); listed in your loop.

    Hope that helps.

    You might like advanced excerpt which allows you to change the length of excerpts and control what tags remain in the excerpt (like image tags).

    As for your original question something like this should work:

    <?php
    if($post->post_excerpt){
      the_excerpt();
    else{
      the_content();
    }
    ?>

    I’m sure you did, but, the permalinks options under the settings menu is all correct?

    When you try and change your permalink settings there (just try one of the other options). Does it say “Permalink structure updated” or something about needing to update your .htaccess file?

    Have you checked to make sure you have a writable .htaccess file present in the root of your wordpress install?

    Are you on an IIS server or Apache?

    Your description is how I understand things at the moment. You can selectively insert images from any previous uploads by going to the Media Library, clicking on “Show” next to the image you want and then clicking the “insert into post” option. You just don’t get it listed as a gallery this way.

    NextGen is a hefty plugin and probably overkill for a smaller projects. There is also Gallery 2 and Duh Gallery. All of them are good in certain situations.

    Hope that helps. Toss me a link to your site here or at churchthemer [at] gmail [dot] com.

    You have a couple of options:

    1. You can create an image.php template file for your theme (copy single.php) and replace:

    <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>

    with

    <div class="alignleft"><?php previous_image_link() ?></div>
    <div class="alignright"><?php next_image_link() ?></div>

    2. You can use a full blown gallery plugin like the NextGen gallery plugin

    3. You can use a plugin that simply adds lightbox functionality to your existing wordpress galleries. The lighbox image views comes with next and previous links: Heres as few plugins/articles to get you started:
    https://justintadlock.com/archives/2008/04/13/cleaner-wordpress-gallery-plugin
    https://www.idratherbewriting.com/2008/07/10/wordpress-image-gallery-example/

    Assuming 2 things:

    1. Your custom field is called: Image
    2. The value of your custom field is something like: https://www.domain.com/images/myImage.jpg

    Find this code in your template file:

    <?php while (have_posts()) : the_post(); ?>

    Immediately after add:

    <?php $key="Image"; $postimage = get_post_meta($post->ID, $key, true); ?>

    To display the image add the below code anywhere in The Loop where you want the image displayed:

    <img src="<?php echo $postimage; ?>" />

    Again, this is assuming your custom field is named “Image” and the value of that field is a fully qualified URL to an image file.

    Hope that helps.

    If you want to add text and or php to the default file which displays posts, change back the “Front page displays” to “your latest posts”.

    Then open:

    index.php – displays your newest posts on the frontpage
    single.php – displays a single post entry
    archive.php – displays posts from a specific category or tag

    You can edit these files however you see fit, simply find the section of these files that says:

    <?php if (have_posts()) : ?>

    and add your text or code in an appropriate container above this code. In the default wordpress template that would look like this:

    <div id="content" class="narrowcolumn">
    
            The text you want to add.
    
        <?php if (have_posts()) : ?>

    If that’s not what your looking for, toss up a link to your site or a screen shot with what you are looking to do.

    Assuming the content you would like displayed in the header is page or post content, you can create a custom wordpress query in the header file to get a specific or series of posts/pages content and then use the regular loop in the template file to get the list a normal posts.

    Here’s an example of a custom query:

    <ul class="header-posts">
    <?php
        $header_query = new WP_Query("cat=42&showposts=10");
        $wp_query->in_the_loop = true;
        while ($header_query->have_posts()) : $header_query->the_post();
    ?>
            <li id="header-post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
        <?php endwhile; ?>
    </ul>

    the above code will get 10 posts from category 42

    1. FTP to your wordpress install and change the permissions of the .htaccess file to 777. This should be the .htaccess file located in the folder where where wordpress is installed usually www or htdocs

    2. Login to wordpress and go to the Settings>>Permalinks area

    3. Select the Month and Name option (or whatever else looks good to you) and hit save changes button on the bottom.

    4. Look for a message at the top that says your permalink structure has been updated vs. one that says you need to update you htaccess file.

    5. Now, for good measure, change the settings on your .htaccess file back.

    Forum: Plugins
    In reply to: Populate a form

    Right on man! I’m really glad you got it sorted.

    Forum: Plugins
    In reply to: Populate a form

    The real trick here is finding out when and why those p tags are being added. Is wordpress converting line breaks to <p> (seems like it) or is something else happening? You may want to check for those characters and/or remove them by using the the content filter hook.

    If wordpress is converting \n to <p> you may want to search for \n and stip it out of the content instead of <p>.

    Something like this:

    function stripP($string){
        global $wp_query;
        $findthis   = '\n';
        //or $findthis   = '<p>';
        $pos = strpos($content, $findthis);
        if ($pos === false) {
            echo "$findthis not found."
        }
        else {
            //Add remove routine here
            echo "$findthis found.";
        }
    }
    add_filter('the_content', 'stripP');

    You may want to check for more then <p>, like </p> or alternate formattings of those tags. You could add these characters to an array and check/remove them in a for each loop or something.

    Hope that helps.

    Didn’t have time to build a control panel and release it as a plugin. So, if you want to try this quick and dirty method add this to the functions.php file for the theme you are currently using:

    function removeFromFeed($string){
        global $wp_query;
        $start="[start]";
        $end="[end]";
        if(is_feed()){
            $string = " ".$string;
            $ini = strpos($string,$start);
            if ($ini == 0) return "";
            $ini += strlen($start);
            $len = strpos($string,$end,$ini) - $ini;
            $remove =  substr($string,$ini,$len);
            $display = str_ireplace($start.$remove.$end,"",$string);
        }
        else{
            $string = str_ireplace($start,"",$string);
            $string = str_ireplace($end,"",$string);
            $display = $string;
        }
        return $display;
    }
    add_filter('the_content', 'removeFromFeed');

    1. Add to functions.php
    2. Enclose what you want to exclude from your feed in [start] [end] on the html tab of your post
    3. Anything weird happens remove the function from the file.

    Hope that helps.

    Forum: Plugins
    In reply to: Populate a form

    There’s a lot more you could do to be more accurate with this but for quick and dirty:

    <?php $content = strip_tags(stripslashes(get_the_content())); ?>
    <form action="">
      <textarea name="test" rows="50" cols="65">
        <?php  echo $content; ?>
      </textarea>
    </form>

    Hope that helps.

    It depends on what you are putting in the custom field to define your thumbnail. Some people put just the file name of the image while others put the full url to the image. Also, let us know what you are calling your custom field and an example of a custom field value and we’ll get you headed in the right direction.

    //date posted
    the_time('l, F jS, Y');
    
    //for comments on homepage and other template pages
    if(is_home()){
     comments_popup_link('No Comments', '1 Comment', '% Comments');
    }
    else{
      comments_number('No Comments', '1 Comment', '% Comments' );
    }
    
    //author
    the_author();
    ?>

    For number of views you’ll need to use a plugin like wp-postviews.

Viewing 15 replies - 16 through 30 (of 84 total)