How to get Text Widget Code over Wordpress Page? - php

Recently i have a requirement from client as he want dynamic sidebar (Text-Widget) content show over the Home Page. So, what ever he enter into text box i.e Link, Image or Text that should be come up over home page.
Can anybody give me hint to show Widget Content over Home or any Page?

Use this plugin Widget Logic
This plugin gives every widget an extra control field called "Widget logic" that lets you control the pages that the widget will appear on. The text field lets you use WP's Conditional Tags, or any general PHP code.

Related

Wordpress - how to add general content area to a specific “page” that's not actually a page?

I purchased a WP theme https://themeforest.net/item/pressville-municipal-wordpress-theme/19949423 and need to add general content area to the People page: https://preview.themeforest.net/item/pressville-municipal-wordpress-theme/full_screen_preview/19949423?_ga=2.67243158.624148492.1570058772-1881232054.1569979687
The People page is actually a section in the WP dashboard (kind of like Media or Portfolio section) so technically not a editable page in the WP backend. I contacted the theme creator and was told that it's customization (not included w/theme) and advised to hard code text into the php. The problem with that is it's not accessible to other users who have no design or code background.. Is there a way to create a page with editable content block for this People section so it's easily editable without knowing code?
Also, the “People” header text changes if you click on subcategories (to “Elected Officials”) for example. When you click a subcategory, the main menu (People page) no longer shows as active which can be confusing to users. Is there a way to fix this so header stays consistent (like Contact page header) and menu item shows active regardless of what subcategory(All, Elected Officials, etc) is selected on the People page? Thanks.
You can create a regular page called "People's page" and add text to it. Then if you want to show that page's content into a PHP template you can do the following:
Step 1. Create the Function
Open up your theme’s functions.php file and paste the following code, likely at the bottom of the page.
function cn_include_content($pid) {
$thepageinquestion = get_post($pid);
$content = $thepageinquestion->post_content;
$content = apply_filters('the_content', $content);
echo $content;
}
Step 2. Use the Function in a Template File
Next, open up the specific template file you want to include the Page’s content on and paste in the function:
<?php cn_include_content(31); ?>
Replace 31 with the ID of the Page you want to include. How to find a page ID.
Is sounds like you need to go to your wp-admin and click appearance/ menus. Here you can remove these menu items that might be default but have no pages associated with them. You can then add the pages you want and come back and create a custom menu. Hope that answers the first part of your question.

Dynamic link to page in Wordpress

So I'm attempting to create a dynamic WordPress link that displays within a post which would change according to the subject page that displays that post.
The link is displayed in a Bootstrap breadcrumb list. I'm using the WordPress "Content View" plugin to gather all posts of a given category ex. "Public Space", and display them on a specific "Public Space" page I've created within WordPress.
The dynamic link currently in use displays the proper title of the category of post being viewed, "Public Space", but it links back to the specific category page instead of my "Public Space" page that uses the proper formatting I need through the "Content View" plugin.
Is there any way to accomplish this without creating individual .php page files for each subject?
Any help would be greatly appreciated!
Here's my code for the breadcrumb:
<?php the_category('title_li='); ?>
Link to the website post with the dynamic breadcrumbs:
http://parkerrichard.com/wordpress/public-space/judgement/
Link to the page the "Public Space" breadcrumb should dynamically link to (and change depending on the post category):
http://parkerrichard.com/wordpress/public-space
Thanks,
Parker
Sorry, I didn't read your post fully. Your problem is you're using a plugin to do templating work, when you could edit the "category.php" page to look like you want.
But if you have to use the plugin, then try this:
Go to Settings > Permalinks in your admin menu.
Then set your permalink structure to custom, and put this in the box:
%category%/%postname%
Then underneath that in your category permalink name field, put a single period - .
Now your category permalinks will have: http://yoursite.com/wordpress/category-name/ instead of yoursite.com/wordpress/category/category-name/
They should link up to the right place now.

how to add a custom field in the "Add New page" page in wordpress

I'm developing a wordpress plugin that would show page specific content in the sidebaer, and I want to specify the content in the "create new page" page.
for example, if I create a page named "ERP product", I may specify some custom HTML markup, that may include a youtube video, a download link, or even just some text. So, if I navigate to the page "ERP product", only then I get to see the specified content in the sidebar widget, other pages may have different values or pages without value may have a different value. I'll find a workaround with the widget part, but I need help with adding the textarea to specify the page specific contents in the "new page" page.
This is what you want I believe:
http://codex.wordpress.org/Function_Reference/add_meta_box
This will allow you to add sidebar boxes to the post/page editor and save the values entered there as custom fields.

WordPress Genisis Featured page widget with an iframe

I have a clients website that uses a WordPress Genisis Framework Child Theme.
One of the widgets that are built into the theme is a featured page widget. It is placed on the front of the page. The widget gathers 250 characters and displays that on the front page along with the featured image from that page.
The problem is that because the next page only contains an iframe from another website the WordPress widget does not grab the text, so it leaves a nice blank hole on the clients homepage. The previous developer set it up this way and didn't bother to plug the hole.
Any ideas how I could get the text to display correctly.
I am familiar with most web languages and the WordPress back end so any suggestions would help.
You can try to place a hidden div on the page where you paste in the text that you want. It wont be dynamic if the integrated page changes but it could be a possible work around.

Having Problems Getting The Correct Widget Area To Display

I have probably missed something but I have been trying to work out what and I am having no luck.
I have added a new page template to my wordpress site, created a new widget area (necessary as this is how the original designer built the site).
However, the page appears to be calling content from another widget area.
The page in question is http://www.haylockpittman.co.uk/builders-painters-decorators-and-refurbishment-contractors-surrey/ and it appears to be calling widget area "New Paint" despite the code calling for "paint surrey" which contains the correct text for the widget area.
For note the widget area is basically the bottom half of the page.
I hope someone might be able to help me get my head round this.
Thanks
As you have created a separate sidebar, now you must be seeing that in your admin panel.
So just add the widgets you want to appear in the sidebar.
Next go to your sidebar.php page, there you cana put a condition i.e. for the products page
If your products page is a separate template then use the name of the file i.e.
if ( is_page_template('your-template.php') ) {
register_sidebr('name of the sidebar');
} else {
register_sidebr('name of the sidebar');
}

Categories