{"id":386,"date":"2006-05-02T09:53:46","date_gmt":"2006-05-02T13:53:46","guid":{"rendered":"http:\/\/www.wehuberconsultingllc.com\/wordpress\/?p=386"},"modified":"2006-05-04T15:24:46","modified_gmt":"2006-05-04T19:24:46","slug":"hacking-widgetphp-for-wordpress","status":"publish","type":"post","link":"https:\/\/wehuberconsultingllc.com\/wordpress\/2006\/05\/02\/hacking-widgetphp-for-wordpress\/","title":{"rendered":"Hacking widget.php for WordPress"},"content":{"rendered":"<p>I started playing with widgets a little more seriously since I found a fix for my XAMPP installation. On a lark I decided to try and use the builtin RSS widget. I didn&#8217;t get the results I expected. The feed I was planning on using is a single item RSS feed that does not have a link in the item element. It does have a guid with the correct http link. The content is in a content:encoded element. So the stuff is in the wrong place for this widget. The RSS widget wants a link element and the content in the description element. What I wanted was a display of the first item with a title linking back to the original website and its content with only the &lt; a &gt; and &lt; br \/ &gt; html tags allowed through.<\/p>\n<p>So I started looking over the widget.php and the other supplied widgets. I ended up hacking the original RSS widget for my tests. Despite not knowing what I am doing I was able to modify the widget and get the required results pretty quickly. The hardest part was getting the strip_tags function to let the line break tag, &lt; br \/ &gt;, through as an allowed tag. I am using the optional &#8220;allowed tag&#8221; parameter with this function. I had to add the slash character(\/) to get it to pass the line breaks through. Adding a space before the slash character like I normally would enter a line break caused the function to remove the line break.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I started playing with widgets a little more seriously since I found a fix for my XAMPP installation. On a lark I decided to try and use the builtin RSS widget. I didn&#8217;t get the results I expected. The feed I was planning on using is a single item RSS feed that does not have &hellip; <a href=\"https:\/\/wehuberconsultingllc.com\/wordpress\/2006\/05\/02\/hacking-widgetphp-for-wordpress\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Hacking widget.php for WordPress&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[],"class_list":["post-386","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4iN3d-6e","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/posts\/386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/comments?post=386"}],"version-history":[{"count":0,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/posts\/386\/revisions"}],"wp:attachment":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/media?parent=386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/categories?post=386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/tags?post=386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}