Forum Replies Created

Viewing 5 replies - 16 through 20 (of 20 total)
  • I now know why it is giving me “5” as the return value, because its counting the result, which is “Array”. So there is a mistake in the syntax.

    Please help? I have no clue on how to proceed.

    for some weird reason, this is not working for me when it comes to reading my custom field characters, but when i test it myself, it works??

    <?php $arabic = "?????? ????? ?? ????? ?????"; ?>
    <?php echo strlen(utf8_decode($arabic)); ?>

    the above strlen function enables it to count utf characters that have more than one byte as one character. So above, its count was “27” characters.

    but when I adopt the same idea for my WP template, strlen counts my summary as “5” characters only, when i know that each summary may have 100+ characters. Here’s the code:

    <?php $recent = new WP_Query("cat=3&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
    <?php $image = get_post_meta($post->ID, 'imageThumb', true); ?>
    <?php $imageURL = get_post_custom_values("imageBig"); ?>
    <?php $summary = get_post_custom_values("articleSummary"); ?>
    <div id="articleSnippet">
        <div id="articleImage"><a href="<?php the_permalink() ?>"><img src="<?php echo $imageURL[0]; ?>" width="156" height="78" /></a></div>
        <div id="articleSummary"><a href="<?php the_permalink() ?>"><strong><?php the_title() ?></strong>
        <br /><?php if (strlen(utf8_decode($summary)) > 40) { echo substr(get_post_custom($before = '', $after = '', FALSE), 0, 40) . '...'; } else { echo $summary[0]; } ?></a></div>
    </div>
    <?php endwhile; ?>

    Am I writing this wrong?

    Thread Starter Haitham

    (@halkibsi)

    Michael, thank you so much for your help.

    I’m a designer, not a coder. I am having a hard time digesting all of this code from so many references. But my life becomes less stressful because of generous people like you.

    Thank you again ??

    Thread Starter Haitham

    (@halkibsi)

    Hi Michael!
    Thanks for your help. I searched Google but unfortunately I was using “WP if latest post condition” keywords, but yours are more relevant, thank you.

    I did find one this article which tackled what I wanted:
    https://jameswhittaker.com/journal/8-top-tips-for-wordpress-theme-development/

    but when I applied it, WP gives me a parse error. Here’s the code:

    <?php query_posts('cat=4&showposts=15&order=DESC'); ?>
    <?php $image = get_post_meta($post->ID, 'imageThumb', true); ?>
    <?php $imageURL = get_post_custom_values("imageBig"); ?>
    <?php $count = 1; ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if ($count == 1) : ?>
    <li id="mycarousel-item-1"><a href="<?php echo $imageURL[0]; ?>" rel="lightbox[image]" id="thumb<?php the_ID(); ?>"><img src="<?php echo $image; ?>" width="133" height="97" /></a></li>
    <?php else : ?>
    <li><a href="<?php echo $imageURL[0]; ?>" rel="lightbox[image]" id="thumb<?php the_ID(); ?>"><img src="<?php echo $image; ?>" width="133" height="97" /></a></li>
    <?php endif; $count++; ?>
    <?php endwhile; ?>

    any ideas? Thanks again.

    Thread Starter Haitham

    (@halkibsi)

    i think i found the answer, a tag called “text-indent” that I can use with a negative value to move my list to the left. Does this validate?

Viewing 5 replies - 16 through 20 (of 20 total)