Forum Replies Created

Viewing 15 replies - 1 through 15 (of 35 total)
  • Thread Starter carl-johan

    (@carl-johan)

    @chris

    Right, makes sense to use WP’s own terminology. Just implemented your current version and that works like a charm. Again, very solid plugin, helps out a lot!

    Cheers

    / Carl-Johan

    Thread Starter carl-johan

    (@carl-johan)

    Hi Jarno

    I ended up writing the functionality myself, but I haven’t had time to make it a proper plugin yet. Not sure if or when I will get that either, so if you are in need of that right now I can’t make any promises. All I can say is I figured it out, and it was not that complicated, there is quite a lot written about saving content to XML using a standard form and POST, and then you need to make the other way around work to, displaying the XML content in a clear and understandable way. I know I found a couple of good blog posts but it’s been quite a while now so sorry, I can’t remember them.

    / Carl-Johan

    carl-johan

    (@carl-johan)

    Mark – you don’t think there’s any chance to get this working with pagination? To me, the sticky posts appear on top (very nice solution btw cheers) but they are not “counted” as parts of the pagination. What I’m trying to say is this, I have set posts_per_page to 3 but on my first page in the pagination I get 3 plus my sticky one.

    Either way, cheers for a nice solution!

    Cheers for that little walk through, did the trick for me!

    I can confirm this works for changing the URL of your site. That is not moving the site but changing the main URL, which I could not seem to do through the Panel like on a standard WP installation?

    In addition, the tables I need to update in the database were: wp_#_options (with # for each site in the multisite), wp_options (I assume, sry don’t remember now :D) and wp_blogs.

    I run WPML for multiple languages, but that seems to be working with out any edits in the DB.

    Again, thanks for this post!

    / CJ

    Thread Starter carl-johan

    (@carl-johan)

    No-one? Or is this in the wrong section? Sorry, never no where my questions are supposed to go.

    Thanks!

    / Carl-Johan

    Thread Starter carl-johan

    (@carl-johan)

    Thanks for your replies, sorry for the overdue answer, busy weekend.

    “Switch_to_blog” sounds like the function I need then, but with 16 or so sub-sites, that might not be a good idea if it’s a heavy call?
    What the best way to evaluate that? Sorry, but I’m really a beginner when it comes to that part of the development, e.g. checking the loading time/database calls etc, but if you can just tell me what it’s called I can google it for myself.

    I could hard code the menu into the theme as well, though it is in 3 languages using WPML so it needs to check what language is currently active etc. That or storing it in wp_sitemeta (thanks for that one btw, never seen it before) will be my last resort, but I’d like to keep it editable through the admin panel if possible.

    Thanks again for your answers!

    Thread Starter carl-johan

    (@carl-johan)

    Yes, those will come real handy I’m sure. Thanks again!

    Thread Starter carl-johan

    (@carl-johan)

    A, cheers man!

    Now I feel really embarrassed ??

    Is there a list of the globals anywhere that I’ve missed? I haven’t been using MU at all, and I’m building my first MS.

    Thanks again!

    This is probably beyond the codex yeah, but I for one would love to see such a solution. Maybe a ‘Super-sticky’ feature for a start, so you can stick posts from all sites to the main site?

    / Carl-Johan

    Thread Starter carl-johan

    (@carl-johan)

    Is this question in the wrong section maybe?

    Thread Starter carl-johan

    (@carl-johan)

    Thanks but yeah, that’s not what I’m after. Using that query I exclude all posts that are in the News category, even if they are in other categories as well. I only want to sort out posts that are in no more categories than News.

    Thanks for the suggestion though ??

    Thread Starter carl-johan

    (@carl-johan)

    For anyone with the same problem. I found a solution that works for me (as well as a presentation of a bunch of other solutions) here:
    https://www.smashingmagazine.com

    The one that does the trick for me is short n sweet:

    global $more;
    
    $more = 0;
    echo '<div id="column1">';
    the_content('');
    echo '</div>';
    
    $more = 1;
    echo '<div id="column2">';
    the_content('',true);
    echo '</div>';
    Thread Starter carl-johan

    (@carl-johan)

    Thanks a lot for getting back to me so quickly Micheal! Didn’t got your code to work though, but I just finished one myself that does, and it’s even working outside the loop;

    <?php global $post;
    $nextTagThumb='-1';
    $tags = wp_get_post_tags($post->ID);
    foreach ($tags as $tag) :
    ?>
    
    <?php
    if ($tags) {
    $what_tag = $tags[($nextTagThumb+'1')]->term_id;
    $args=array(
    'tag__in' => array($what_tag),
    'post__not_in' => array($post->ID),
    'showposts'=>100,
    'caller_get_posts'=>1
    );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <li>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    <?php the_post_thumbnail(); ?>
    </a>
    </li>
    <?php endwhile;
    }
    wp_reset_query();
    $nextTagThumb = ($nextTagThumb+1);
    }
    ?>
    <?php endforeach; ?>

    As you will see, it’s based on your original code, I just added a foreach loop for all the tags of the post and a variable that grows with each tagged post. Not sure how kosher my code is, and if you see an obvious error or issue please let me know, otherwise it’s doing the job.

    Thanks again for getting back to me, was going to post the code I just finished when I saw your post.

    /Carl-Johan, Sweden

    Thread Starter carl-johan

    (@carl-johan)

    Is this in the wrong forum? If so, please tell me where I should post this topic. Thanks!

    Thanks Michael, worked great for me too.
    I did some minor changes though, I’ll share them if anyone is looking for the same function I was (getting titles under 40 characters);

    First I added a $after variable so that truncated titles gets whatever you add after the truncation (in my case 3 dots ‘…’)

    Then I noticed that adding these lines to my markup gave all the titles an extra whitespace before the title, so I converted it all into a function which I added to my functions.php and now I just need to call <?php short_title(); ?> in my template.
    I know I could probably just have played around with the linebreaks and found the whitespace but this also has the advantage that it is easy to use where ever I want shorter.

    Also added an $length variable so the final function looks like this:

    function short_title($after = '', $length) {
    	$mytitle = get_the_title();
    	if ( strlen($mytitle) > $length ) {
    	$mytitle = substr($mytitle,0,$length);
    	echo $mytitle . $after;
    	} else {
    	echo $mytitle;
    	}
    }

    Call from the template:
    <?php short_title(‘…’, 40); ?>

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