Show part of front page on another page [closed]
You must separate the template file who you want Like get_template_part(‘file_without_php’);
You must separate the template file who you want Like get_template_part(‘file_without_php’);
I believe your best solution will be to setup postdata and the making use of the the_content() template tag $post = get_page_by_title( ‘About us’ ); setup_postdata( $post ); ?> <p> <?php the_content(); ?> </p> <?php wp_reset_postdata(); ?>
The WordPress doesn’t operate with concept of partial content. The content of the post is seen as single block of text/markup, possibly with embedded external elements. Even in latter case that is considered one way flow — content output will process embeds, but embeds aren’t meant to be extracted from content. In your case I … Read more
I am not exactly sure what you’re question is but I think you are looking for something like this, mostly cribbed from the Codex: if ( is_active_sidebar( ‘sidebar-1’ ) ) { ?> <ul id=”primary”><?php dynamic_sidebar( ‘sidebar-1’ ); ?> </ul><?php } If the sidebar is not in use, no markup will display. You could add an … Read more
You can try doing this: $string = “Some text before the link http://www.youtube.com/?123 some text after the link”; preg_match_all(‘@(https?://www\.?youtube.com/.[^\s.,”\’]+)@i’, $string, $matches); var_dump($matches); In your case would be something similar to this: preg_match_all(‘@(https?://www\.?youtube.com/.[^\s.,”\’]+)@i’, $post->post_content, $matches); foreach($matches as $match){ echo “<video>$match</video>”; }
There might be two reasons for your problem You are using <!–more–> tag inside your content . If so then remove it. While querying post you are using the_excerpt method , if so then change it to the_content .
Found a solution which is working. Splitting the array like above just gives you the plain text so shortcodes wont work. this works: global $post; $content = get_extended( $post->post_content ); //get the_content $excerpt = $content[‘main’]; //get the teaser part before more tag $main_content = apply_filters(‘the_content’, $content[‘extended’]); //get part after more tag echo $excerpt; //post teaser … Read more
How to hook into search results template or query?
This is what I suggest get your RSS feed for site A http://codex.wordpress.org/WordPress_Feeds Install this plugin to Site B https://wordpress.org/plugins/rss-post-importer/ It has the option to grab the post and save as draft. As for email you might need to add some code to send an email out when a new post is added. function SendOutEmail($to, … Read more
You can get the diff between your 2 contents and then add to the first one a given number of words like this (not sure, but give it a try 😉 ) : global $more; $more = 0; $content_cut = get_the_content( ” ); $more = 1; $content_full = get_the_content(); // Get the diff $content_diff = … Read more