Forum Replies Created

Viewing 15 replies - 1 through 15 (of 42 total)
  • Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Done.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Thanks for your advises. I have done that :

    I have try Firefox after IE and it makes the same

    I have not try asking someone who has never logged into try and do so as a Level 2 user because I don’t know someone I can trust (If you have time for us, I can create you an access level 2)

    I have disabled all plugins and it makes almost the same. The only difference is that as an admin, I can see now the 84 first pages (there are others I can’t see). As a user level 2, I always can see, edit, delete all pages.

    Have you got an idea to try ?

    What a usefull answer !

    I need the same thing… and I can’t find anywhere any solution… This parameter seems so needed and obvious for wp-archives…

    One silly question : If I DON’T want to upload in the wp-content folder, but in another one, I can’t anymore ???!!!
    It’s rare when a 0.2 makes less think than a 1.5, isn’t it ?

    My server is in safe mode and I can’t anymore upload anything… Why a simple upgrade makes things so ugly ?!

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Yeeeeees ! I’m simply the best. See :

    To truncate pages titles in the admin dropdown menu, make this :

    1. Put this function in a plugin called “heisthebest.php” :

    function tronquer($admin_titre) {
    $MAX_LENGTH = 45;
    $TERMINATOR = ‘ …’;

    if(strlen($admin_titre) > $MAX_LENGTH){
    $parts = explode(‘ ‘, $admin_titre);
    $admin_titre = “”;
    $i = 0;

    while(strlen($admin_titre) < $MAX_LENGTH && $i < count($parts)){
    if(strlen($parts[$i]) + strlen($admin_titre) > $MAX_LENGTH){
    return $admin_titre . $TERMINATOR;
    } else {
    $admin_titre .= ‘ ‘ . $parts[$i];
    $i++;
    }
    }

    return $admin_titre . $TERMINATOR;
    } else{
    return $admin_titre;
    }
    }

    (thanks to truncate title plugin : https://dev.wp-plugins.org/browser/truncate-title/ / I have only change some parameters names and erase the last line whitch make bugs in our case)

    2. Activate the plugin !

    3. Go in wp-admin/admin-functions.php and replace this function :

    function parent_dropdown($default = 0, $parent = 0, $level = 0) {
    global $wpdb, $post_ID;
    $items = $wpdb->get_results(“SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = ‘static’ ORDER BY menu_order”);

    if ($items) {
    foreach ($items as $item) {
    // A page cannot be it’s own parent.
    if (!empty($post_ID)) {
    if ($item->ID == $post_ID) {
    continue;
    }
    }
    $pad = str_repeat(‘ ‘, $level * 3);
    if ($item->ID == $default)
    $current = ‘ selected=”selected”‘;
    else
    $current = ”;

    echo “\n\t<option value=’$item->ID’$current>$pad $item->post_title</option>”;
    parent_dropdown($default, $item->ID, $level + 1);
    }
    } else {
    return false;
    }
    }

    whith this one :

    function parent_dropdown($default = 0, $parent = 0, $level = 0) {
    global $wpdb, $post_ID;
    $items = $wpdb->get_results(“SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = ‘static’ ORDER BY menu_order”);

    if ($items) {
    foreach ($items as $item) {
    // A page cannot be it’s own parent.
    if (!empty($post_ID)) {
    if ($item->ID == $post_ID) {
    continue;
    }
    }
    $pad = str_repeat(‘ ‘, $level * 3);
    if ($item->ID == $default)
    $current = ‘ selected=”selected”‘;
    else
    $current = ”;

    // HAPAX CHANGES

    $titre = $item->post_title;
    $titre = tronquer($titre);

    echo “\n\t<option value=’$item->ID’$current>$pad $titre</option>”;
    parent_dropdown($default, $item->ID, $level + 1);

    // FIN HAPAX CHANGES

    }
    } else {
    return false;
    }
    }

    And now you have a great little select menu of your pages titles ! ??

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    J’ai fait peur ?? tout le monde ! :-))

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Yes. I have try to apply the truncate title function (from the same name plugin) to this wp-function, but it doesn’t work… :

    function tronquer_admin_titres($admin_titre) {
    $MAX_LENGTH = 45;
    $TERMINATOR = ‘ …’;

    if(strlen($admin_titre) > $MAX_LENGTH){
    $parts = explode(‘ ‘, $admin_titre);
    $admin_titre = “”;
    $i = 0;

    while(strlen($admin_titre) < $MAX_LENGTH && $i < count($parts)){
    if(strlen($parts[$i]) + strlen($admin_titre) > $MAX_LENGTH){
    return $admin_titre . $TERMINATOR;
    } else {
    $admin_titre .= ‘ ‘ . $parts[$i];
    $i++;
    }
    }

    return $admin_titre . $TERMINATOR;
    } else{
    return $admin_titre;
    }
    }

    add_filter(‘the_title’, ‘tronquer_admin_titres’);

    (I have change names to not truncate every titles in my site !)

    So with this function in an activate plugin, I have change in admin-function.php the original parent_dropdown function with :

    function parent_dropdown($default = 0, $parent = 0, $level = 0) {
    global $wpdb, $post_ID;
    $items = $wpdb->get_results(“SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = ‘static’ ORDER BY menu_order”);

    if ($items) {
    foreach ($items as $item) {
    // A page cannot be it’s own parent.
    if (!empty($post_ID)) {
    if ($item->ID == $post_ID) {
    continue;
    }
    }
    $pad = str_repeat(‘ ‘, $level * 3);
    if ($item->ID == $default)
    $current = ‘ selected=”selected”‘;
    else
    $current = ”;

    ////////////////////////////////////////////////////:
    $item = tronquer_admin_titres($item);
    /////////////////////////////////////////////////////

    echo “\n\t<option value=’$item->ID’$current>$pad $item->post_title</option>”;
    parent_dropdown($default, $item->ID, $level + 1);
    }
    } else {
    return false;
    }
    }

    I’m not a code killer, so it can be simply a quote problem ! I just touch and look… since the beginning.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Yes it’s a solution, but not “clean”. I want something more intuitive for authors. You think it’s technicaly impossible to truncate titles generate by this function ?

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    Here is apparently the function whitch displays the pages tree :

    function parent_dropdown($default = 0, $parent = 0, $level = 0) {
    global $wpdb, $post_ID;
    $items = $wpdb->get_results(“SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = ‘static’ ORDER BY menu_order”);

    if ($items) {
    foreach ($items as $item) {
    // A page cannot be it’s own parent.
    if (!empty($post_ID)) {
    if ($item->ID == $post_ID) {
    continue;
    }
    }
    $pad = str_repeat(‘ ‘, $level * 3);
    if ($item->ID == $default)
    $current = ‘ selected=”selected”‘;
    else
    $current = ”;

    echo “\n\t<option value=’$item->ID’$current>$pad $item->post_title</option>”;
    parent_dropdown($default, $item->ID, $level + 1);
    }
    } else {
    return false;
    }
    }

    in admin-functions.php
    Now the challenge is to truncate… Oulala !…

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    No. It’s not possible, because when title are display at another place in the site, they must be complete. University has got rigid codes that we can’t break.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    I absolutely need this functionnality. No one knows the javascript trick for that ? :-O

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    I can’t because titles are scientific article titles, and so they must have a certain form. You can see the problem on public side here :

    https://www.cometes.org/index.php

    (all is manage with wordpress)

    The “num??ros” of the revue are “Pages” : https://www.cometes.org/revue/numeros/

    Do you know how to fix ? I’m trying since 2 days and I don’t succed :-(.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    So no one knows how to transmit a $variable on wordpress with permalinks. Me neither.

    Thread Starter hapaxlegomen

    (@hapaxlegomen)

    You’re right. I have try. 2 content id is not working.
    Thankx a lot anyway for your help on all my topics (:-)).

Viewing 15 replies - 1 through 15 (of 42 total)