Blumish Posted February 10, 2013 Report Share Posted February 10, 2013 (edited) Sveicināti!.Man ir tāda problēma.Lietoju wordpress dzini. Kurā esmu ievietojis facebook komentārus. Vēlos lai šie komentāri rādās jau pirmajā lapā. To esmu panācis. Otrais ko vēlējos ir tas lai viņi defultā ir slēpti zem js, un atvert tos varētu piespiežot vienkātši "Komentāri" pogu. To arī es panācu. Bet problēma slēpjas tajā, ka komentāri atveras uzreiz visiem rakstiem, nevis vienam noteiktajam.Šeit es iekopēšu pašu wp kodu kad izvada to sākumlapu, un js kodu kas paslējpj šos facebook komentārus. <?php /** * Loop template * * This file is responsible for generating all code in * the WordPress loop. * * @package Ghostbird * @author Michael Fields <michael@mfields.org> * @copyright Copyright (c) 2011-2012 Michael Fields * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 1.0 */ if ( have_posts() ) { while ( have_posts() ) { the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php do_action( 'ghostbird_entry_start' ); switch ( get_post_format() ) { case 'aside' : case 'link' : print "\n" . '<div class="entry-content">'; the_content( __( 'Continue Reading', 'ghostbird' ) ); print "\n" . '</div><!--entry-content-->'; break; case 'status' : ghostbird_featured_image( '<div class="featured-image">', '</div>' ); print "\n" . '<div class="entry-content">'; the_content( __( 'Continue Reading', 'ghostbird' ) ); print "\n" . '</div><!--entry-content-->'; break; default : ghostbird_featured_image( '<div class="featured-image">', '</div>' ); /* * Title only for multiple views. * Will be displayed in single views via ghostbird_title() in an H1 element. */ if ( ! is_singular() ) { the_title( "\n" . '<h2 class="entry-title"><a href="' . get_permalink() . '">', '</a></h2>' ); } print "\n" . '<div class="entry-content">'; if ( ( is_archive() || is_home() ) && ( 'page' == get_post_type() || 'gallery' == get_post_format() ) ) { the_excerpt(); } else { the_content( __( 'Continue Reading', 'ghostbird' ) ); } print "\n" . '</div><!--entry-content-->'; wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'ghostbird' ), 'after' => '</div>' ) ); print '<div class="' . esc_attr( ghostbird_entry_meta_classes() ) . '">'; ghostbird_entry_meta_date(); ghostbird_entry_meta_taxonomy(); print '</div><!--meta-->'; break; } do_action( 'ghostbird_entry_end' ); ?> </div><!--entry--> <?php } } ?> Un JS, kurā jau ir iestradati facebook komentāri. <script src="http://code.jquery.com/jquery-latest.js"></script> <button style="float:right;color:#3B5998;margin-top:-2px;margin-right:5px;text-decoration:underline;"><fb:comments-count href="<?php echo get_permalink($post->ID); ?>">Komenāri</button> <p style="display: none" class="fb-comments" data-href="<?php the_permalink() ?>" data-num-posts="2" data-width="738"></p> <script> $("button").click(function () { $("p").show("slow"); }); </script> izmēģināju šo: $("button").click(function () { $(this).next("p").show("slow"); }); bet arī nekā Liels paldies, un ceru ka palīdzēsiet! Edited February 10, 2013 by Blumish Quote Link to comment Share on other sites More sharing options...
daGrevis Posted February 10, 2013 Report Share Posted February 10, 2013 http://en.wikipedia.org/wiki/Indent_style Quote Link to comment Share on other sites More sharing options...
php newbie Posted February 10, 2013 Report Share Posted February 10, 2013 tas p varbūt vienkārši ir tukšs? Es par facebook api neko nezinu.Ja tajā p ieliek kko manuāli tad viss notiek:http://jsfiddle.net/4nN2X/p.s. daGrevis kā vienmēr ļoti "noderīgs" posts Quote Link to comment Share on other sites More sharing options...
daGrevis Posted February 10, 2013 Report Share Posted February 10, 2013 > p.s. daGrevis kā vienmēr ļoti "noderīgs" posts Aha, indentācija nav svarīga. Turpini rakstīt tādu kodu.... Quote Link to comment Share on other sites More sharing options...
php newbie Posted February 10, 2013 Report Share Posted February 10, 2013 > p.s. daGrevis kā vienmēr ļoti "noderīgs" posts Aha, indentācija nav svarīga. Turpini rakstīt tādu kodu.... Interesants secinajums. Drošivien ilgi nedomāji Quote Link to comment Share on other sites More sharing options...
daGrevis Posted February 10, 2013 Report Share Posted February 10, 2013 Sarkasms. Sarkasms! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.