Forum Replies Created

Viewing 15 replies - 61 through 75 (of 81 total)
  • Thread Starter ndjworldnews

    (@ndjworldnews)

    UPDATE:

    Using BCWORKS suggesting of using the ‘post__in’ argument in my array I got the function to work perfectly. Thanks again BCWORKS!

    But … it means that I have to manually update the post__in array every time I publish a new post. Not very convenient plus I might forget.

    After tweaking around I bit I came up with an automated solution that does not require manually updating the array. Here’s the code for anyone who has a need for it.

    $post_list = get_posts( array(
    ‘numberposts’ => ‘4’
    ) );
    $posts = array();
    foreach ( $post_list as $post ) {
    $posts[] += $post->ID;
    }

    $arr=array($posts[0],$posts[1],$posts[2],$posts[3]);
    $args = array(
    ‘post_type’ => ‘post’,
    ‘category_name’ => $featured_cat_name,
    ‘post__in’ => $arr,
    ‘orderby’ => ‘rand’
    );
    query_posts($args);

    Thanks again for the support.

    God bless;

    Lode

    Thread Starter ndjworldnews

    (@ndjworldnews)

    bcworkz

    (@bcworkz)

    Thank you so much. That worked beautifully. Much appreciate your help.

    God bless.

    Lode

    Thread Starter ndjworldnews

    (@ndjworldnews)

    Hello a2hostingrj

    (@a2hostingrj)

    Thank you for the quick response. Unfortunately this plugin does not do what I want to accomplish. My goal is to be able to display the last four posts I published with post one being displayed with a big picture, post 2 a medium picture and post 3 and 4 with a small picture (I got that done). When you refresh the page those exact same posts should then be shuffled around randomly and for argument’s sake post #3 takes the place of post #1 and post #2 replaces post #4 and post #1 becomes #3 and #1 becomes #3. The page gets refreshed again and those same posts shuffle around yet again, displaying in different order yet again. That’s what I am looking to do.

    Thanks for you answer. I do appreciate it.

    Lode

    Thread Starter ndjworldnews

    (@ndjworldnews)

    Issue has been solved by hosting company. What they did? I honestly don’t know.

    Thread Starter ndjworldnews

    (@ndjworldnews)

    The issue went away on its own. No clue what caused it and no clue what made it disappear.

    Thread Starter ndjworldnews

    (@ndjworldnews)

    Thanks for the response. I have no plugins. Customizer doesn’t allow me to save anything, including header image and so on.

    Uninstalling and reinstalling the theme doesn’t make a difference.

    Thanks.

    Forum: Fixing WordPress
    In reply to: Pay per video
    Thread Starter ndjworldnews

    (@ndjworldnews)

    HI JNashHawkins

    Thank you for that info but you are right that would be too much involvement having to do that for every video. I gather I’ll be contacted someone to write a custom theme for me.

    Have a good one.

    Lode

    Forum: Fixing WordPress
    In reply to: Pay per video
    Thread Starter ndjworldnews

    (@ndjworldnews)

    Hi Steven;

    Thank you so much for the quick response. I actually checked all these links you provided (and many others) before I posted my inquiry here. None of them seem to offer what I am looking for. They all offer a membership, meaning logging in is required and based on the subscription rights the member can then access certain payable content. It’s not what I am after.

    Thank you though. Appreciate your answer.

    Lode

    Thread Starter ndjworldnews

    (@ndjworldnews)

    *** typo: load my site (not side). Sorry!

    Forum: Hacks
    In reply to: Sql command needed
    Thread Starter ndjworldnews

    (@ndjworldnews)

    Hey catacaustic;

    Thank you so very much. Not only does this work, the code is much shorter and my site loads faster too ?? . Thank you. I really do appreciate this.
    Hope I can return the favor one day.
    Have a great one.

    Lode

    Forum: Hacks
    In reply to: Sql command needed
    Thread Starter ndjworldnews

    (@ndjworldnews)

    Dear catacaustic;

    Hey thanks for the response. I took your suggestion and added the post_status=”publish” option to the query and low and behold that fixed my problem.

    Thanks. I truly appreciate it.

    Lode

    Forum: Hacks
    In reply to: Sql command needed
    Thread Starter ndjworldnews

    (@ndjworldnews)

    BTW I forgot to add that the variable $number is set to 4.

    Thanks

    Forum: Hacks
    In reply to: Sql command needed
    Thread Starter ndjworldnews

    (@ndjworldnews)

    Thanks for the response.

    Maybe I am doing something wrong elsewhere then.

    Here’s my entire code:
    <?php
    $posts = “SELECT * from $wpdb->posts WHERE post_type=’post’ ORDER BY post_date DESC LIMIT 4”;
    $postX = array();
    $postresult = mysql_query($posts) or die(mysql_error());
    while ($row = mysql_fetch_array($postresult)) {
    $postX[] = $row[0];
    }
    //$ids = shuffle($postX);
    $ids = implode(‘,’, $postX);
    //echo $ids;
    $args = array(
    ‘showposts’=> $number,
    ‘post__in’ => explode(‘,’, $ids),
    ‘orderby’ => ‘rand’,
    );
    query_posts($args); ?>

    What I am trying to accomplish is that the last four posts are displayed in random order each time the website is loaded. But for
    some reason, my code only seems to give me the desired result when
    I post 4 new articles every day. If I skip a day, the result is nothing or 1 or 2 posts are shown.

    Thanks

    Lode

    PS thanks for the suggestion to add the post_status.

    Thread Starter ndjworldnews

    (@ndjworldnews)

    Hi Esmi;
    No I haven’t but I certainly will. Thanks for the advice.

    Lode

    Thread Starter ndjworldnews

    (@ndjworldnews)

    hello;

    Thanks again for the help. I figured it out.

    Here’s the code I created and works like a charm:

    <?php
    $string = get_permalink();
    $string = “$string”;
    $malestr = str_replace(“textsite”, “www”, $string);
    ?>
    Image Article: “><b><?php the_title(); ?></b>

    Just beautiful.

    Thanks again

    Lode

Viewing 15 replies - 61 through 75 (of 81 total)