Skip to content

Instantly share code, notes, and snippets.

<?php
function ibenic_buddypress_tab() {
global $bp;
bp_core_new_nav_item( array(
'name' => __( 'My recent Posts', 'ibenic' ),
'slug' => 'recent-posts',
'position' => 100,
'screen_function' => 'ibenic_budypress_recent_posts',
@igorbenic
igorbenic / example1.php
Last active December 3, 2022 07:34
How to create WordPress Menu Pages with OOP | http://www.ibenic.com/creating-wordpress-menu-pages-oop/
<?php
$customWPMenu = new WordPressMenu( array(
'slug' => 'wpmenu',
'title' => 'WP Menu',
'desc' => 'Settings for theme custom WordPress Menu',
'icon' => 'dashicons-welcome-widgets-menus',
'position' => 99,
));
@igorbenic
igorbenic / action1.php
Last active February 21, 2024 21:32
How to add a Custom Column in WordPress with OOP | http://www.ibenic.com/add-custom-column-wordpress-oop/
<?php
// Action Hook to add column value for posts
add_action( 'manage_posts_custom_column' , 'your_function', 10, 2 );
@igorbenic
igorbenic / content.php
Last active March 31, 2016 21:31
How to Create Sharing Buttons similar to Jetpack | http://www.ibenic.com/create-sharing-buttons-similar-jetpack/
<?php
function my_share_render_in_content( $content ) {
ob_start();
?>
<ul id="my_share" class="my_share">
<li>
<a href="<?php the_permalink();?>?my_share=facebook">Facebook</a>
</li>
<li>
<?php
function ibenic_custom_menu( $menu_item ) {
// If we are in the admin area, skip this function
if ( is_admin() ) {
return $menu_item;
}
// If this isn't a Sample Page menu item, skip this function
if ( $menu_item->title != "Sample Page" ) {
@igorbenic
igorbenic / example_false.php
Last active April 19, 2024 13:40
Handle WordPress Remote Requests with OOP | ibenic.com
<?php
$remote_request = new WordPressRemoteJSON( 'https://leanpub.com/wpb3/coupons.json', array( 'body' => array("coupon_code" => "coupon-code-123456" ) ), "post" );
$remote_request->run(); //False
@igorbenic
igorbenic / settings.php
Last active February 21, 2024 21:32
How to Create Dynamic WordPress Email Templates | http://www.ibenic.com/create-dynamic-wordpress-email-templates/
<?php
function ibenic_email_template_settings() {
// Section
add_settings_section(
'email_templates_section',
'Dynamic Email Templates',
'ibenic_email_templates_section',
'email-templates'
);
@igorbenic
igorbenic / abstract.php
Last active December 26, 2022 07:02
How to Create Extendable WordPress Forms | http://www.ibenic.com/create-extendable-wordpress-forms/
<?php
abstract class WordPress_Extendable_Form {
/**
* Array of errors
* @var array
*/
protected $errors = array();
@igorbenic
igorbenic / admin.css
Last active April 2, 2020 03:49
How to Create a Sortable WordPress Gallery | http://www.ibenic.com/create-sortable-wordpress-gallery/
.sortable_wordpress_gallery li.attachment {
width: 141px;
height: 141px;
}
.sortable_wordpress_gallery {
display: block;
}
.sortable_wordpress_gallery:after {
display: table;
content: '';
<?php
class WordPress_Custom_Status {
/**
* Post Types for this status
* @var array
*/
protected $post_type = array();