{"id":20009080,"url":"https://github.com/gambitph/gambit-wordpress-helper-functions","last_synced_at":"2026-05-15T07:03:44.940Z","repository":{"id":152947991,"uuid":"62147078","full_name":"gambitph/Gambit-WordPress-Helper-Functions","owner":"gambitph","description":"A collection of helper functions which we use in our various WordPress plugins and themes. Feel free to use them in your own.","archived":false,"fork":false,"pushed_at":"2016-06-30T07:05:16.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-12T14:30:17.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gambitph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2016-06-28T14:20:59.000Z","updated_at":"2019-04-03T18:30:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cc90f20-7301-44da-add5-f01323ca6d4e","html_url":"https://github.com/gambitph/Gambit-WordPress-Helper-Functions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gambitph%2FGambit-WordPress-Helper-Functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gambitph%2FGambit-WordPress-Helper-Functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gambitph%2FGambit-WordPress-Helper-Functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gambitph%2FGambit-WordPress-Helper-Functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gambitph","download_url":"https://codeload.github.com/gambitph/Gambit-WordPress-Helper-Functions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241447520,"owners_count":19964314,"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":[],"created_at":"2024-11-13T07:14:16.771Z","updated_at":"2026-05-15T07:03:44.854Z","avatar_url":"https://github.com/gambitph.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gambit's WordPress Helper Functions\nA collection of helper functions which we use in our various WordPress plugins and themes. Feel free to use them in your own.\n\n# Usage\nRequire it in your WordPress project:\n\n    require_once( 'gambit-helpers.php' );\n\nUse it:\n\n\tadd_filter( 'the_content', 'do_something_only_in_the_content_not_in_excerpts' );\n\n\tfunction do_something_only_in_the_content_not_in_excerpts( $content ) {\n\t\tif ( ! gambit_is_doing_excerpt() ) {\n\t\t\t$content .= 'I should only show up in post content and not excerpts.';\n\t\t}\n\t\treturn $content;\n\t}\n\n# Helper functions\n\n| Helper Function | Returns | Description |\n| --- | :---: | --- |\n| `gambit_is_doing_excerpt()` | `boolean` | Returns `true` if currently creating an excerpt. Useful while inside `the_content` filters. |\n| `gambit_get_all_post_types()` | `array` | Gets all the post types currently registered. Returns an associative array of all post type slugs and post type names. |\n| `gambit_get_all_taxonomies()` | `array` | Gets all the taxonomies currently in the site. Returns an associative array of all taxonomy ids and post type names. |\n| `gambit_get_all_terms_of_post_type($post_type)` | `array` | Gets all the taxonomies associated with a post type. Returns an array of all taxonomy ids. |\n| `gambit_get_current_url()` | `string` | Gets the current URL, regardless whether we are in a singular page or not. |\n| `gambit_abbreviate_number($value)` | `string` | Abbreviates a number with a unit. E.g. Converts 1100 to 1.1K |\n| `gambit_hex_to_rgb($hex)` | `array` | Converts a hex color `#ffffff` or `#fff` to rgb `array(255,255,255)` |\n| `gambit_hex_to_rgba($hex, $opacity=1.0)` | `string` | Converts a hex color `#ffffff` or `#fff` and an opacity value `1.0` to an rgba string `rgba(255,255,255,1.0)` |\n| `gambit_get_ip()` | `string` | Gets the current IP address of the visitor |\n| `gambit_is_spam($content)` | `boolean` | Checks whether a given content is spam using Akismet's system. Returns `true` if Akismet tagged the given content as spam, `false` otherwise. Requires Akismet. If it isn't installed, this always returns `false`. |\n| `gambit_get_video_provider($video_string)` | `array` | Gets the Video ID \u0026 Provider (whether YouTube or Vimeo) from a video URL or ID. Supports only YouTube and Vimeo. E.g. Converts `https://www.youtube.com/watch?v=dQw4w9WgXcQ` to `array('type'=\u003e'youtube', 'id'=\u003e'dQw4w9WgXcQ')` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgambitph%2Fgambit-wordpress-helper-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgambitph%2Fgambit-wordpress-helper-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgambitph%2Fgambit-wordpress-helper-functions/lists"}