The second part of this question…is there any way to show the full posts on the home page? Thanks on both.
]]>Can anyone tell me how to have post and page titles link to the individual post/page?
For example, if i have a page titled ‘page 1’, how do i have the title be a link when i am on that page?
A wordpress theme, Precious by Kristin K. Wangen, has this feature and i’d like mine to be like it.
I don’t have a site to show but if someone could help with the info i’ve provided i’d be grateful.
Thanks
]]>jana
https://www.homeschooljungle.com/archives/
I’m doing this manually right now
Here is an example of what happens on this page right here. If you go straight to the text and hover over it you will see that it becomes underlined. If you hover over the Post Title, and then just work your way down the page, you see that it stays showing the URL of the original post:
https://outsidervocals.com/alternative-indie/
And here is all the code that is in the inline page editor screen…..can someone please tell me if I took a character out I shouldn’t have? Thanks!
<?php
/*
Plugin Name: Inline Posts
Plugin URI: https://aralbalkan.com/wordpress/
Description: Allows you to include posts in pages (and in other posts). To include a post, just enter its ID in square brackets in the body of a page or another post (e.g., 42).
Version: 2.1.2.g
Author: Aral Balkan
Author URI: https://aralbalkan.com
*/
//
// Options/admin panel
//
add_option(‘inlineposts_title_tag’, ‘h2’, ‘The tag you want the titles of posts to appear in.’);
// Add page to options menu.
function addAdminPage()
{
// Add a new submenu under Options:
add_options_page(‘Inline Posts Options’, ‘Inline Posts’, 8, ‘inlineposts’, ‘displayAdminPage’);
}
// Display the admin page.
function displayAdminPage()
{
if (isset($_POST[‘inlineposts_update’]))
{
check_admin_referer();
// Update title tag
$titleTag = $_POST[‘inlineposts_title_tag’];
if ($titleTag == ”) $titleTag = ‘h2’;
update_option(inlineposts_title_tag, $titleTag);
// echo message updated
echo “<div class=’updated fade’><p>Inline Posts options updated.</p></div>”;
}
?>
<div class=”wrap”>
<h2>Inline Posts Options</h2>
<form method=”post”>
<fieldset class=’options’>
<table class=”editform” cellspacing=”2″ cellpadding=”5″ width=”100%”>
<tr>
<th width=”30%” valign=”top” style=”padding-top: 10px;”>
<label for=”inlineposts_title_tag”>Title tag:</label>
</th>
<td>
<input type=’text’ size=’16’ maxlength=’30’ name=’inlineposts_title_tag’ id=’inlineposts_title_tag’ value='<?= get_option(‘inlineposts_title_tag’); ?>’ />
The tag you want the titles of posts to appear in.
</td>
</tr>
<tr>
<td colspan=”2″>
<p class=”submit”><input type=’submit’ name=’inlineposts_update’ value=’Update Options’ /></p>
</td>
</tr>
</table>
</fieldset>
</form>
</div>
<?php
}
//
// Actual functionality
//
function includePosts ($content = ”)
{
// Get the Post IDs to include. Post IDs are in the form [nnn].
preg_match_all(‘/(?<=\\[\\[)\\d+?(?=\\]\\])/’, $content, $matches, PREG_PATTERN_ORDER);
// Create a table of contents for the top of the page.
$tableOfContents = ‘
$numMatches = count($matches[0]);
for ($i = 0; $i < $numMatches; $i++)
{
$titleTag = get_option(‘inlineposts_title_tag’);
$postId = $matches[0][$i];
$post = get_post($postId);
$linkToPost = ‘‘;
$postTitle = $post->post_title;
// Update the table of contents
$tableOfContents .= ‘
‘;
$postTitleText = “<$titleTag>$linkToPost$postTitle$anchorTag</$titleTag>”;
$postBodyText = ‘<p>’.format_to_post($post->post_content).'</p>’;
$text = $postTitleText. $postBodyText;
// Remove comments and any line breaks before the tags
// so that these don’t cause WordPress to insert extra
//
tags.
$content = preg_replace(‘/<!–.*?–>/’, ”, $content);
$content = str_replace(“\r\n[[“, ‘[[‘, $content);
// Replace the post placeholder with the actual post.
$content = str_replace(“[[$postId]]”, $text, $content);
}
$tableOfContents .= ‘
‘;
// Add top anchor
$content = ‘<p id=”top” />’.$content;
// Add the TOC if user requested it
$content = str_replace(“TOC“, $tableOfContents, $content);
error_log($tableOfContents);
return $content;
}
//
// Hooks
//
add_action(‘admin_menu’, ‘addAdminPage’);
add_filter(‘the_content’, ‘includePosts’, 1);
?>
]]>I am using version 2.8, recently updated.
I am using worpdress theme called painter.
I am very new to WP.
No one seems to be able to see why this is happening and how to fix it. Please help me find a solution.
Kay Green
https://www.mypreciouskid.com/blog/