Forum Replies Created

Viewing 15 replies - 16 through 30 (of 42 total)
  • I was looking for the same thing. The code below should do the trick:

    <?php
    $trim_length = 5;  //desired length of text to display
    $custom_field = 'my-custom-field-name';
    $value = get_post_meta($post->ID, $custom_field, true);
    if ($value) {
     echo rtrim(substr($value,0,$trim_length));
    }
    ?>

    Worked perfectly for me!

    Thread Starter Stef Verbeeck

    (@twizted)

    For those of you that might ever look for a solution, here it is:

    <?php
    $tags = get_the_tags();
    _e(tag_description(),'qtranslate');
    ?>

    Does this work for Tag descriptions as well? I tried this code in my templates tag.php, without success:

    <?php
    $posttags = get_the_tags();
    _e($posttags[0]->tag_description, ‘qtranslate’);
    ?>

    Thread Starter Stef Verbeeck

    (@twizted)

    Okay, for those who encounter the same problem and want to display the posts within a custom taxonomy like you display the posts within a classic category, here are the two steps:

    1. create a template called “taxonomy-xxx.php”, where xxx is the custom taxonomy name
    2. use this code: <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); ?> instead of query_posts to show the posts for the selected taxonomy

    Thanks to Monday By Noon for ending my day-long quest and answering a question which should NOT be so hard to find an answer to imho…

    Thread Starter Stef Verbeeck

    (@twizted)

    I tried this:

    <?php
    query_posts( array('taxonomy' => 'services', 'posts_per_page' => 50) ); ?>

    Butt it didn’t work. All it does is display my 50 latest posts in the classic ‘posts’ type. No clients, not belonging to any services specified in the url. ??

    Thread Starter Stef Verbeeck

    (@twizted)

    That’s awesome, I didn’t even think of changing the css, I was planning to dig into the actual PHP, but this is way easier.

    Thanks for your advice!

    Thread Starter Stef Verbeeck

    (@twizted)

    The thing is, it didn’t use to work under default theme, that was one of the first things I examined along with disabling all installed plugins.

    I’ve pasted the code for functions.php here. I’ve highlighted a change I made to prevent the category 626 (which are seminars, showed as modified posts) from showing in the queries on my homepage and blogpage between the “regular” posts.

    I’ve changed simple things, for instance the way the “read more…” link is displayed, or the way unordered lists are created for the sidebar. Come to think of it: the wp-admin folder may be unchanged.

    Last night I remembered playing around with some plugins for event management for our seminars-page. One of these plugins worked by reserving one specific category for events and keeping that category from being published elsewhere than in some sort of calendar. I removed the plugin after testing, but had to delete some MySQL manually after delete.

    Thread Starter Stef Verbeeck

    (@twizted)

    When I switch the theme to “default”, it returns the exact same array, with ampersand after the question mark.

    Crazy thing is, when I clicked the feed link in the footer of my site when in “default” theme, it showed a complete RSS feed without errors (which it didn’t before). Switching back to my own theme causes the RSS feed to return an empty feed once more.

    I didn’t change anything to the template files used for RSS, they are an exact copy of the default files used to create my own theme with. So where could this error be? The links are the same, and a few weeks back the default theme also returned a broken feed…

    I’m hessitant to overwrite my wp-admin and wp-includes folders, as I’ve modified some of the files within wp-includes over the course of the past few months.

    Thread Starter Stef Verbeeck

    (@twizted)

    Success! This code returns a long array, I’ve posted it in a pastebin as requested.

    Thread Starter Stef Verbeeck

    (@twizted)

    Nope, Linux/Apache server.

    Thread Starter Stef Verbeeck

    (@twizted)

    I get no results, when I run that exact query for wp_options (db selected, default prefix), this is what is returned:

    MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec)

    How can this be?

    By the way, when I manually browse the wp_options tables, there is no variable called “rewrite_rules” under “options_name”.

    Thread Starter Stef Verbeeck

    (@twizted)

    That’s all I see, it is on 3 lines like such:

    <!-- code to copy
    <pre></pre>
    end code to copy -->

    No info there, though my permalinks work as they should using /%postname%

    I am familiar with PhpMyAdmin, yes.

    Thread Starter Stef Verbeeck

    (@twizted)

    Okay, so now I’ve pasted this code in my footer.php file, ut all I get is plain text, no array. ??

    <!-- code to copy <pre></pre>end code to copy -->

    Thread Starter Stef Verbeeck

    (@twizted)

    Sorry for the delay. Meanwhile I’ve downloaded the contents of my .htaccess file, and although I’m not an expert, I don’t think it has anything out of the ordinary, right?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I tried pasting the code you provided in both my theme’s index.php and header.php, but with no results, all I see in the code is an extra blank line where the array should appear…

    Thread Starter Stef Verbeeck

    (@twizted)

    Disabled all plugins, re-saved permalinks. No change…

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