Extending theme PHP class in plugin

Make your class visible to PHP after the theme has declared the parent class. Plugins are loaded first, the theme maybe later. This can be overridden. Theme code is available when the action after_setup_theme is fired, so you could use it like this: add_action( ‘after_setup_theme’, function() { require ‘ChildClass.php’; }); However, if the theme loads … Read more

How can I detect hierarchal relationships beyond children (grandchild, great-grandchild, etc)?

Turns out there is an excellent function that has been passed around the WordPress forums is_tree() function is_tree($pid) { // $pid = The ID of the page we’re looking for pages underneath global $post; // load details about this page $anc = get_post_ancestors( $post->ID ); foreach($anc as $ancestor) { if(is_page() && $ancestor == $pid) { … Read more

How to add an option for “nofollow” to the Link editor’s existing “Link Relationship(XFN) options list?

Alternatively you can undo the code that disables the relationship box by re-pointing the enqueue to the xfn.js script.. First create a modified version of that script, like so.. jQuery(document).ready( function($) { //$(‘#link_rel’).attr(‘readonly’, ‘readonly’); $(‘#linkxfndiv input’).bind(‘click keyup’, function() { var isMe = $(‘#me’).is(‘:checked’), inputs=””; $(‘input.valinp’).each( function() { if (isMe) { $(this).attr(‘disabled’, ‘disabled’).parent().addClass(‘disabled’); } else { … Read more

How to edit my theme for full width?

yes, go to your /wp-content/themes/manifest_v1.1/style.css and edit the following IDs to look like this: #siteWrapper{ margin: 0 auto; padding-top: 15px; width: 97%; text-align: center; position: relative; } #coreContent{ float: auto; width: auto; margin-top: 8px; } #footer{ width: 97%; margin: 40px auto 0; padding: 20px 0 35px 0; border-top: 4px double #ccc; color: #666; text-align: center; … Read more

How to create a multiple choice radio group for a single theme option

case “radio”: foreach ($value[‘options’] as $option) { ?> <label for=”<?php echo “{$value[‘id’]}_{$option}”; ?>”> <input type=”radio” name=”<?php echo $value[‘id’]; ?>” id=<?php echo “{$value[‘id’]}_{$option}”; ?> value=”<?php echo $option; ?>” <?php checked($option, get_settings($value[‘id’])); ?> /> <?php echo $option; ?> </label> <?php } break; But I don’t recommend coding theme/plugin settings this way. The array above doesn’t just represent … Read more