{"id":26465173,"url":"https://github.com/trberrido/wp-mini","last_synced_at":"2026-05-20T09:07:25.250Z","repository":{"id":221841065,"uuid":"755171490","full_name":"trberrido/wp-mini","owner":"trberrido","description":"WP mini: mini wordpress block theme","archived":false,"fork":false,"pushed_at":"2024-02-14T13:23:07.000Z","size":573,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-02-14T23:40:27.162Z","etag":null,"topics":["gutenberg-theme","wordpress-theme-development"],"latest_commit_sha":null,"homepage":"https://wp.dafox.co","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trberrido.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-09T15:18:04.000Z","updated_at":"2024-02-14T23:40:27.163Z","dependencies_parsed_at":"2024-02-10T14:31:30.964Z","dependency_job_id":"36da2ad5-dbfb-4c0b-9441-0dcc9e66db36","html_url":"https://github.com/trberrido/wp-mini","commit_stats":null,"previous_names":["trberrido/wp-mini"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trberrido%2Fwp-mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trberrido%2Fwp-mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trberrido%2Fwp-mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trberrido%2Fwp-mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trberrido","download_url":"https://codeload.github.com/trberrido/wp-mini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244403899,"owners_count":20447158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gutenberg-theme","wordpress-theme-development"],"created_at":"2025-03-19T09:59:20.860Z","updated_at":"2026-05-20T09:07:20.212Z","avatar_url":"https://github.com/trberrido.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP-mini\n\n## Key concepts\n\n### The query loop\nOne of the main way to display a list of posts if the `get_posts()` functions.\n\n- It returns an array of posts.\n- It takes an array as parameter. This array is the same used for WP_Query, see all available options: https://developer.wordpress.org/reference/classes/wp_query/#parameters\n\nOne interesting option is filtering on ACF's field, see:\n- https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters\n- https://www.advancedcustomfields.com/resources/query-posts-custom-fields/\n\n\nA basic example to retrieve a list of post of a specific custom post type:\n\n```\n\n$args = array(\n\t'post_type'\t\t=\u003e 'a_custom_post_type'\n);\n\n$posts = get_posts( $args );\n\nforeach ( $posts as $post ){\n\techo get_the_title( $post-\u003eID );\n}\n```\n\nMore about *the loop*: https://developer.wordpress.org/themes/basics/the-loop/\n\n### Hooks\nThe construction process of a response by WordPress is a pipeline of steps.\nThe developper can insert code at any of these step, by adding a callback function to a `hook`. Calling hooks is the way to add features to WordPress.\n\n#### Actions\nAction hooks enable to edit the way WordPress works.\n\nTypically, one will call the `enqueue_block_assets` hook to add its own stylesheets.\n```\nadd_action( 'enqueue_block_assets', function() { wp_enqueue_style( ... ); });\n```\n\n#### filters\nFilters hooks enable to edit *the data* WordPress is working on.\n\nFor eg, one can add specific data on each items of a menu list through the `wp_nav_menu_objects` \n```\n// notes:\n// - the 3rd parameter indicates the priority of the callback\n//\tfor when there's several callbacks attached to a same hook\n// - the 4th parameter is the number of arguments the callback can expect to receive\n\nadd_filter( 'wp_nav_menu_objects', 'wpmini__menu__add_smileys', 10, 2 );\n\nfunction wpmini__menu__add_smiley( $items, $args ) {\n\tforeach( $items as $item ){\n\t\t$item-\u003etitle = ':D ' . $item-\u003etitle;\n\t}\n\treturn $items;\n}\n```\n\nSee: https://developer.wordpress.org/plugins/hooks/\n\n## Useful functions\n\n### Styles:\n- adding css files: `wp_enqueue_style()`\n- associating css files with specific blocks, will be loaded as inline css: `wp_enqueue_block_style()`\n\nAbout style priorities (without any `!important`):\nblock editor option \u003e enqueued stylesheets \u003e theme.json \u003e default styles from WordPress\n\n### Scripts:\n- adding js files: `wp_enqueue_script()`\n- making some server side's datas accessible to the client: `wp_add_inline_script()`\n\n### Menu (classical) \n- to add a menu: `register_nav_menus()`\n- to edit a menu: `add_filter( 'wp_nav_menu_objects', 'fn' )`\n- to load a menu: `wp_nav_menu()`\n\n### Block\n- register a block: `register_block_type()`\n- add style variations to a block: `register_block_style()`\n- rendering a block: `render_block()`\n- get block attributes (classes, styles): `get_block_wrapper_attributes()`\n\n### Custom post type / custom tax\n- `register_taxonomy()`\n- `register_post_type()`\n\nTo clearly separate types of content\nhttps://developer.wordpress.org/reference/functions/register_post_type/\n\n### Patterns\nIt is possible to export / import your own pattern https://learn.wordpress.org/tutorial/creating-your-own-custom-synced-or-non-synced-patterns/\n\n### Ajax\n\nServer side:\n\n```\nadd_action( 'wp_ajax_{action_name}', 'fn' );\n// if the ajax call has to be accessible to loggued-out users:\nadd_action( 'wp_ajax_nopriv_{action_name}', 'fn' );\n```\n\nClient side:\n\n```\nfetch(\n\twpmini.adminURL + '/admin-ajax.php?action={action_name}'\n).then( blablabla )\n```\n\n### Environment types\n\nIn /wp-config.php :\n```\ndefine( 'WP_DEVELOPMENT_MODE', 'production' );\n```\n\nEnable different behaviors with :\n```\nwp_get_environment_type():string\n```\nsee more: https://developer.wordpress.org/reference/functions/wp_get_environment_type/\n\n## Minimal required files for a new block theme\n- theme.json\n- templates/index.html\n- style.css\n\n### optional folders\n - styles: can contain variations that will override the main theme.json.\n - parts: contains headers and footers\n\n## References\n\n### Wordpress\n- WP coding standards: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/\n- WP handbooks / docs: https://developer.wordpress.org/block-editor/getting-started/\n- FSE introduction: https://fullsiteediting.com/lessons/preparations-quick-start-guide/\n- Twentytwentyfour theme: https://github.com/WordPress/twentytwentyfour\n\n### Misc\n- BEM: css classes naming methodology: https://getbem.com/\n- DSFR https://www.systeme-de-design.gouv.fr/\n\n## todo\n- rajouter template hierarchy\n- ACF field : get field + filter query\n- more infos about theme.json\n- theme.json file: add examples of style.someblock \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrberrido%2Fwp-mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrberrido%2Fwp-mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrberrido%2Fwp-mini/lists"}