شما می تونید یک پست رو منتشر کنید و بعد در گیست گیت هاب به اشتراک بگذارید یا یک فرمت ایجاد کنید که این امکان رو بده براتون یه شرت کد بسازه . کد زیر رو در function.php قرار بدید.
// function gist_shortcode($ atts) { return sprintf( '<script src="https://gist.github.com/%s.js%s"></script>', $ atts['id'], $ atts['file'] ? '?file=' . $ atts['file'] : '' ); } add_shortcode('gist','gist_shortcode'); // Remove this function if you don't want autoreplace gist links to shortcodes function gist_shortcode_filter($ content) { return preg_replace('/https:\/\/gist.github.com\/([\d]+)[\.js\?]*[\#]*file[=|_]+([\w\.]+)(?![^<]*<\/a>)/i', '', $ content ); } add_filter( 'the_content', 'gist_shortcode_filter', 9);
هر یک از فرمت های زیر کار می کند:
- https://gist.github.com/1147076
- https://gist.github.com/1147076#file_annotated.js
- https://gist.github.com/1147076.js?file=annotated.js
برگرفته از : wp-snippets
مبنع این خبر (برای مشاهده متن کامل خبر لینک زیر را بزنید):
تک آموز