Skip to content

Instantly share code, notes, and snippets.

View rintoug's full-sized avatar

Rinto George rintoug

View GitHub Profile
<config>
<modules>
<Namespace_Modulename>
<version>0.1.0</version>
</Namespace_Modulename>
</modules>
</config>
@rintoug
rintoug / gist:fbdb6a08ca3998d00ccabacf4965cd06
Last active July 20, 2016 06:17
Insert a post programatically in wordpress
require_once "ABSOLUTE_PATH/script/wp-load.php";
@rintoug
rintoug / gist:c7c2ce14b467c4d9f4260d27b911c658
Last active June 11, 2017 06:06
Insert a post programatically in wordpress
<?php
$slug = 'your-post-slug';
$title= 'Your post title';
$post_content = 'Your lonng post title';
$post_id = wp_insert_post(
array(
'comment_status' => 'closed',
'ping_status' => 'closed',
'post_author' => $author_id,
@rintoug
rintoug / gist:0195fd98cac04091ed7539d12e45d9d5
Last active June 11, 2017 06:06
Insert a post programatically in wordpress
<?php
require_once('ABSOLUTE_PATH/wp-admin/includes/media.php');
require_once('ABSOLUTE_PATH/wp-admin/includes/file.php');
require_once('ABSOLUTE_PATH/wp-admin/includes/image.php');
$media = media_sideload_image($image, $post_id); //$post_id from wp_insert_post
// therefore we must find it so we can set it as featured ID
if(!empty($media) && !is_wp_error($media)){
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Contacts>
<active>true</active>
<codePool>local</codePool>
</Namespace_Contacts>
</modules>
</config>
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Contacts>
<version>0.0.1</version>
</Namespace_Contacts>
</modules>
<frontend>
<routers>
<contacts>
$product = Mage::getModel('catalog/product')->load($productId);
$cats = $product->getCategoryIds();
foreach ($cats as $category_id) {
$_cat = Mage::getModel('catalog/category')->load($category_id) ;
echo $_cat->getName();
}
<?xml version="1.0"?>
<config>
<modules>
<Writeyoucode_Customer>
<active>true</active>
<codePool>local</codePool>
</Writeyoucode_Customer>
</modules>
</config>
<?xml version="1.0"?>
<config>
<modules>
<Writeyourcode_Customer>
<version>1.0</version>
</Writeyourcode_Customer>
</modules>
<frontend>
<routers>
<?php
/**
* Account controller
*
*/
require_once 'Mage/Customer/controllers/AccountController.php';
class Writeyourcode_Customer_AcccountController extends Mage_Customer_AccountController
{
/**
* Product view action