Każdy temat założony w ewidentnie złym dziale będzie usuwany! Proszę czytać opisy działów i regulamin!
![]() ![]() |
09.10.2007 - 18:49
Post
#1
|
|
|
aktywność: ![]() Grupa: Bloger Postów: 1 Nr: 3 129 |
Witam, jak mogę zaimportować linki z innego bloga wordpress? Z pliku zaimportowały sie same kategorie, a takze wpisy etc... ale linków nie ma.
Dzięki za pomoc. |
|
|
|
16.10.2007 - 09:41
Post
#2
|
|
![]() aktywność: ![]() ![]() ![]() ![]() ![]() ![]() ![]() Grupa: Redakcja Postów: 878 Nr: 2 641 |
Sam import linków to nie problem. W zakładce Blogroll jest też pod-zakładka Import links. Problemem jest wyeksportowanie linków do formatu opml.
Ja skorzystałam z takiego rozwiązania Poniższy kod zachowaj jako plik links2opml.php i wrzuc do wordpressa, z którego chcesz wyeksportować linki (ten plik musi byc na tym samym poziomie co wp-config). CODE <?php /* Set $show_all to 0 (zero) to hide links set to 'No' under Visible in Links Manager, or 1 to display all links. */ $show_all = 1; /* To restrict to a specific link category add the link category ID under $link_cats. Separate multiples with a comma ('1,3,5'). Use 'all' or leave $link_cats empty ('') for all link categories. */ $link_cats = ''; if( isset($_GET['cat']) ) $link_cats = $_GET['cat']; require_once('./wp-config.php'); header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true); function rss_it($link_array, $column) { $column = 'link_' . $column; $linkdata = strip_tags($link_array->$column); $linkdata = htmlspecialchars($linkdata, ENT_QUOTES); $linkdata = convert_chars($linkdata); echo $linkdata; } $owner = get_userdata(1); $name = ($owner->display_name) ? convert_chars($owner->display_name) : convert_chars($owner->user_firstname) . ' ' . convert_chars($owner->user_lastname) ; $email = convert_chars($owner->user_email); ?> <?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> <!--Links2OPML - a WordPress script created by Kaf Oseo (http://szub.net) OPML generated by WordPress/<?php bloginfo_rss('version'); ?> --> <opml version="1.1"> <head> <title><?php bloginfo_rss('blogname'); ?> blogroll</title> <ownerName><?php echo $name; ?></ownerName> <ownerEmail><?php echo $email; ?></ownerEmail> <dateModified></dateModified> </head> <body> <?php $query = "SELECT link_url, link_name, link_target, link_description, link_rss FROM $wpdb->links"; if(!$show_all) { $query .= " WHERE link_visible = 'Y'"; } if($link_cats && !('all' == $link_cats)) { $link_cats = preg_split("/[\s,]+/", $link_cats); foreach($link_cats as $link_cat) { if($show_all && !$count) { $query .= " WHERE link_category = '$link_cat'"; $count++; } else { if(!$count) { $query .= " AND link_category = '$link_cat'"; $count++; } else { $query .= " OR link_category = '$link_cat'"; } } } } $links = $wpdb->get_results($query); foreach($links as $link) : ?> <outline text="<?php rss_it($link, 'name'); ?>" type="link" description="<?php rss_it($link, 'description'); ?>" url="<?php rss_it($link, 'url'); ?>" xmlurl="<?php rss_it($link, 'rss'); ?>" target="<?php rss_it($link, 'target'); ?>" /> <?php endforeach; ?> </body> </opml> Potem w wordpressie do którego chcesz importowac linki wejdź (w panelu administracyjnym) w blogroll -> import links i podaj URl http://strona-z-ktorej-importujesz-link/link2opml.php . U mnie to pięknie wyszło i mam nadzieję, że Tobie też sie uda Pozdrawiam, Kasia -------------------- Curiosity killed the cat, but satisfaction brought her back.
|
|
|
|
![]() ![]() |
| Wersja Lo-Fi | Aktualny czas: 3 12 08 - 03:37 |