Skip to content

Instantly share code, notes, and snippets.

@guizmo
Created May 24, 2012 02:49
Show Gist options
  • Save guizmo/2779144 to your computer and use it in GitHub Desktop.
Save guizmo/2779144 to your computer and use it in GitHub Desktop.
Snag list message
/*
** first add custom body class in function.php (page slug/name)
** see code in body-class.php snippet
*/
/*
** Then map the messages to the appended body class
*/
var todo = {
'home' : 'This is the home page to do message',
'services' : 'Add in editable fields (kw)',
'about' : 'Add in editable fields (kw)',
'blog' : 'Add in responsive JS to cater for colour image (kw) // Style up related older posts (ejs) // Add in styles for no image header i.e. big text (ejs)',
'single-post' : 'Style up related posts and categories (ejs) // Add in styles for no image header i.e. big text (ejs)'
};
/*
** If the value is present I then create a div, add in the relevant message and then inject it before the element with the class of "MYCLASS" in my template
*/
$.each(todo, function(i, val) {
if( $('body').hasClass(i) ) {
var msg = document.createElement('div');
$(msg).addClass('msg');
$(msg).html('<p>'+val+'</p>');
$(msg).insertBefore('.MYCLASS');
};
});
/*
** Finish it by adding some CSS
*/
/*
.msg { background: #9CE783; border-bottom: 5px solid #006600; padding: 1em; font-size: 1.2em; text-align: center; color: #444; }
.msg p:before { content: 'TO DO: '; font-weight:bold; }
*/
// Reference : http://viewportindustries.com/blog/wordpress-page-template-snag-lists/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment