WordPress object for comments frame [closed]

So long as you’re in the loop, you can just use the standard template tags: <script type=”text/javascript” charset=”utf­8″> initFrame({ app_id: “”, object_id: <?php the_ID() ?>, object_title: “<?php the_title_attribute() ?>”, object_content: ‘<?php echo wp_trim_words( strip_shortcodes( striptags( get_the_content() ) ), 45 ) ?>’, object_url: “<?php the_permalink() ?>”, arguments_container: “comment-naqeshny”, width: 610 }); </script>

diffrent style for post single page

You could listen for the $_SERVER[‘HTTP_REFERER’] and add a class to the body depending on that referer add_filter( ‘body_class’,’wpse_body_classes’ ); function wpse_body_classes( $classes ) { if ( is_page( ‘event’ ) ){ // event is the page slug of the page we wish to add the class for if( wp_get_referer() == ‘/url/of/get_involved’ ){ $classes[] = ‘my-light-bg’; … Read more

Custom post type not respecting template hierarchy

From what you’ve told us, your single-case-study.php should be the correct file. To help troubleshoot, add this line to your header.php: <!– <?php global $template; print_r($template); ?> –> Then view the source of a single case study and see which template WP is outputting. Once you have identified the file, if the solution isn’t clear, … Read more

Set a cookie only in single posts

init is too early (it happens before the main query), use the action template_redirect instead. And for the ID use get_the_ID(). Example: if ( is_singular() ) setcookie( get_the_ID(), ‘visited’,time() + ( DAY_IN_SECONDS * 31 ) );

Custom seperate Single.php

This should help, if you need more info: http://codex.wordpress.org/Template_Hierarchy Simply put, WordPress looks for template files in the following order for single posts: single-{post_type}.php, single.php, index.php. If you want to override the standard single.php file, that’s how (for a custom post type only, as you’re using)

Is it possible to create rel=”noindex, nofollow” for a single post if contain bad keywords?

<head> <meta charset=”<?php bloginfo( ‘charset’ ); ?>”> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <link rel=”profile” href=”http://gmpg.org/xfn/11″> <?php if (is_single()){ //add more keywords in regex code $badWords = array(“badwords”,”badkeyword”); $string = get_the_content(); $matches = array(); $matchFound = ”; $matchFound = preg_match_all(“/\b(” . implode($badWords,”|”) . “)\b/i”,$string,$matches); } ?> <meta name=”robots” content=”index,follow <?php echo $matchFound ?>” /> <?php wp_head() ?> … Read more

Display a post map on a blank/new page

After some more Googling… New single.php looks like this: <?php get_header(); global $wp_query; if ( ! isset( $wp_query->query_vars[‘map’] ) ) { if (have_posts()) : while (have_posts()) : the_post(); the_title(); the_content(); endwhile; endif; ?> <p><a href=”https://wordpress.stackexchange.com/questions/31442/<?php echo get_permalink(); ?>?map=yes”>Map</a></p> <?php } else { ?> <div id=”map-canvas”></div> <?php } get_footer(); And functions.php like this: add_filter(‘query_vars’, ‘parameter_queryvars’ ); … Read more

Only nextpagelink on wp_link_pages

You’ll have to prepare your own custom function instead of wp_link_pages to use in single.php file of your template. Here’s the custom function my_wp_link_pages proposal (contains original wp_link_pages code with commented out lines): function my_wp_link_pages($args=””) { $defaults = array( ‘before’ => ‘<p>’ . __(‘Pages:’), ‘after’ => ‘</p>’, ‘link_before’ => ”, ‘link_after’ => ”, /*’next_or_number’ => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)